2017-02-18 200 views
2

當我使用npm start命令運行我的第一個反應應用程序時,會顯示一些錯誤。請有人幫我解決這個問題npm start給出錯誤:`output.path`必須是絕對路徑或`/`

C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:386 
       throw e; 
       ^

Error: `output.path` needs to be an absolute path or `/`. 
    at Object.setFs (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\lib\Shared.js:88:11) 
    at Shared (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\lib\Shared.js:214:8) 
    at module.exports (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\middleware.js:22:15) 
    at new Server (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\lib\Server.js:56:20) 
    at startDevServer (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:379:12) 
    at processOptions (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:317:3) 
    at Object.<anonymous> (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:441:1) 
    at Module._compile (module.js:571:32) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 

npm ERR! Windows_NT 6.2.9200 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 
npm ERR! node v7.5.0 
npm ERR! npm v4.1.2 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `webpack-dev-server` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'webpack-dev-server'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the r3 package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  webpack-dev-server 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs r3 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls r3 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\ankit\Desktop\r3\npm-debug.log 
+0

這是什麼? http://meta.stackexchange.com/questions/80538/how-to-ask-questions-on-stack-overflow –

+0

請提供'webpack.config.js'的代碼。閱讀[this](http://stackoverflow.com/help/mcve) – wuxiandiejia

+1

[Getting:Error:\ output.path \'必須是絕對路徑或\'/ \'](http:/ /stackoverflow.com/questions/42166492/getting-error-output-path-needs-to-be-an-absolute-path-or) –

回答

3

該錯誤信息是明確的:output.path必須

你output.path應該寫這樣的絕對路徑或/

var path = require('path'); 

output: { 
    path: path.join(__dirname, './dist/'), 

} 
+0

給出一些關於你的答案的細節 – praveenkumar

相關問題