webpack-dev-server的“npm start”错误

我知道这是一个形成问题的可怕的方式,但我已经研究了几个小时,并没有取得任何进展。 一切正常昨天晚上,今天早上我有一个从App Store的更新,使我重新启动,现在我的npm服务器(我试图学习React.js)不起作用。 这是我的错误日志:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using npm@4.0.5 3 info using node@v4.6.1 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle react-essential@1.0.0~prestart: react-essential@1.0.0 6 silly lifecycle react-essential@1.0.0~prestart: no script for prestart, continuing 7 info lifecycle react-essential@1.0.0~start: react-essential@1.0.0 8 verbose lifecycle react-essential@1.0.0~start: unsafe-perm in lifecycle true 9 verbose lifecycle react-essential@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/FrankHarvey/Dropbox/react-practice/node_modules/.bin:/Users/FrankHarvey/anaconda2/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin 10 verbose lifecycle react-essential@1.0.0~start: CWD: /Users/FrankHarvey/Dropbox/react-practice 11 silly lifecycle react-essential@1.0.0~start: Args: [ '-c', 'webpack-dev-server' ] 12 silly lifecycle react-essential@1.0.0~start: Returned: code: 1 signal: null 13 info lifecycle react-essential@1.0.0~start: Failed to exec start script 14 verbose stack Error: react-essential@1.0.0 start: `webpack-dev-server` 14 verbose stack Exit status 1 14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) 14 verbose stack at emitTwo (events.js:87:13) 14 verbose stack at EventEmitter.emit (events.js:172:7) 14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) 14 verbose stack at emitTwo (events.js:87:13) 14 verbose stack at ChildProcess.emit (events.js:172:7) 14 verbose stack at maybeClose (internal/child_process.js:829:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 15 verbose pkgid react-essential@1.0.0 16 verbose cwd /Users/FrankHarvey/Dropbox/react-practice 17 error Darwin 16.3.0 18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 19 error node v4.6.1 20 error npm v4.0.5 21 error code ELIFECYCLE 22 error react-essential@1.0.0 start: `webpack-dev-server` 22 error Exit status 1 23 error Failed at the react-essential@1.0.0 start script 'webpack-dev-server'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the react-essential package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error webpack-dev-server 23 error You can get information on how to open an issue for this project with: 23 error npm bugs react-essential 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls react-essential 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ] 

我试过了:

  • 交换端口
  • 恢复git提交
  • sudo重新安装节点

没有工作。

node_modules目录中删除webpack-dev-server并运行npm install webpack-dev-server

感谢评论,我能够解决。 我尝试通过使用npm install重新npm install 。 这没有奏效。 然后我尝试使用npm install webpack-dev-server并出现错误。 它一直说像xyz/abc/node_modules/xyz/node_modules/abc/.bin/file存在。 移动并重试。 我试了几次,最后删除了我的node_modules目录下的整个webpack-dev-server目录并重新安装。 现在一切正常。

顺便说一句,我使用Lynda.com的“React.js基本培训”。 只有包含这个信息的其他人可能有这个问题。