0

我正在尝试使用 webpack 和 npm 为我的 reactJS 应用程序编译文件。当我跑步时:

npm install --save react-websocket

它工作正常。接下来当我执行

npm start

收到以下错误:

> reactapp@1.0.0 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! reactapp@1.0.0 start: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp@1.0.0 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

有人可以帮我吗?

4

1 回答 1

0

我认为您的系统上没有安装 webpack-dev-server。

npm install -g webpack-dev-server 

在 cmd/终端上运行上述命令。希望它能解决您的问题。

于 2016-11-07T16:22:21.027 回答