2016-11-07 55 views
0

我想用我的reactJS applciation編譯webpack和npm的文件。 當我運行時:在Windows上的npm啓動錯誤

npm install --save react-websocket 

它的工作正常。 接下來當我執行

npm start 

得到以下錯誤:

> [email protected] start D:\ReactServer 
> webpack-dev-server --hot 

'webpack-dev-server' is not recognized as an internal or external command, 
operable program or batch file. 

npm ERR! Windows_NT 6.3.9600 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program  Files\\nodejs\\ 
node_modules\\npm\\bin\\npm-cli.js" "start" 
npm ERR! node v4.4.7 
npm ERR! npm v2.15.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `webpack-dev-server --hot` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'webpack-dev-server -- hot'. 
npm ERR! This is most likely a problem with the reactapp package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  webpack-dev-server --hot 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs reactapp 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls reactapp 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  D:\ReactServer\npm-debug.log 

任何人可以幫助我嗎?

+0

錯誤說'webpack-dev-server'有點不對。從[webpack開發工具](https://webpack.github.io/docs/installation.html#dev-tools)文檔看起來您需要另外安裝它。你是否? – makadev

回答

0

我想你沒有在你的系統上安裝webpack-dev-server。

npm install -g webpack-dev-server 

在cmd/terminal上運行上述命令。希望它能解決你的問題。

+0

我運行了命令,但仍然得到相同的錯誤.. –

+0

你是否運行了這個命令,並以cmd作爲Admin?運行。嘗試在您的package.json所在的項目目錄中運行它。運行以下命令。 npm install webpack-dev-server –