【问题标题】:start npm error (npm install --save-dev webpack)启动 npm 错误(npm install --save-dev webpack)
【发布时间】:2020-04-13 12:26:42
【问题描述】:

你能帮我解决这个问题吗? 我想为 git hub 上的 rebus 项目做出贡献,所以我克隆了它,并添加了一个 rebus 对象。 安装更新nodejs和npm后,在虚拟机中通过linux本地运行游戏。然后,我做了npm start。 但结果如下。

> rebus@1.0.0 start /home/mara/opso/rebus
> webpack-dev-server --mode development

sh: 1: webpack-dev-server: not found

npm ERR! Linux 5.0.0-36-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! rebus@1.0.0 start: `webpack-dev-server --mode development`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the rebus@1.0.0 start script 'webpack-dev-server --mode development'.
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 rebus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server --mode development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs rebus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls rebus
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/mara/opso/rebus/npm-debug.log

搜索解决问题后,我发现我不得不做sudo npm install -g webpack-dev-server 但是错误仍然存​​在。

/usr/local/bin/webpack-dev-server -> /usr/local/lib/node_modules/webpack-dev-server/bin/webpack-dev-server.js
npm WARN webpack-dev-server@3.10.1 requires a peer of webpack@^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@3.7.2 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ webpack-dev-server@3.10.1
added 400 packages from 272 contributors in 28.25s

你能帮我解决这个问题并成功地“npm start”吗?

【问题讨论】:

    标签: npm webpack


    【解决方案1】:

    你需要添加这个依赖

    npm install --save-dev webpack

    【讨论】:

    • events.js:183 throw er; // 未处理的“错误”事件 ^ npm ERR! Linux 5.0.0-36-通用 npm 错误! argv "/usr/bin/node" "/usr/bin/npm" "start" npm ERR!节点 v8.10.0 npm 错误! npm v3.5.2 npm 错误!代码 ELIFECYCLE npm 错误! rebus@1.0.0 开始:webpack-dev-server --mode development npm 错误!退出状态1(但仍然是同样的问题)
    猜你喜欢
    • 1970-01-01
    • 2016-08-18
    • 2021-11-11
    • 2016-01-08
    • 2020-09-25
    • 1970-01-01
    • 2020-10-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多