node.js - "npm start"webpack-dev-server 错误

标签 node.js reactjs npm webpack-dev-server

我知道这是一种糟糕的提问方式,但我已经研究了几个小时,但没有取得任何进展。昨晚一切正常,今天早上我从 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

都没有用。

最佳答案

做事总是好的

rm -rf node_modules && npm install

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

多亏了评论,我才得以解决。我尝试使用 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 基本培训”时使用了它。仅为可能遇到此问题的其他人包含此信息。

关于node.js - "npm start"webpack-dev-server 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41576446/

相关文章:

angular - 无法升级到 Angular 6,范围无效

node.js - NestJS 中同一 Controller (路由别名)的两个端点

node.js - 从 Windows 批处理文件返回字符串

reactjs - npm ERR!找不到404-GET https://registry.npmjs.org/@typescript-eslint%2feslint-plugin-找不到

javascript - 有没有办法从我网站的每个浏览器中删除滚动条?

javascript - 类型错误 : Webpack imported module is not a function

node.js - casperjs 错误 : casper has no method start when running from node. js

node.js - 从 bash 脚本运行 Node

javascript - 如何正确地将 github 上的拉取请求包含到我的 React-Native-Web 构建中?

node.js - 如果我没有使用 GitHub,npm 如何提交 package-lock.json