【问题标题】:unable to install and run nodemon npm - Nodejs无法安装和运行 nodemon npm - Nodejs
【发布时间】:2020-10-21 22:44:15
【问题描述】:

我无法运行我的 nodejs 项目,出现以下错误。

> restfullnodejs@1.0.0 start C:\Users\PC\restfullnodejs
> nodemon app.js

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! file C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! path C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! restfullnodejs@1.0.0 start: `nodemon app.js`
npm ERR! spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe ENOENT
npm ERR!
npm ERR! Failed at the restfullnodejs@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PC\AppData\Roaming\npm-cache\_logs\2020-07-01T13_04_14_121Z-debug.log

我的猜测是 nodemon 的错误,如果是这样,我该如何解决这个问题。也无法安装nodemon

更新 删除 package-lock.json 文件和 nodemodules 文件夹后尝试npm clear cache --force 然后npm install - g nodemon

然后低于错误

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\nodemon\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! file C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! path C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! nodemon@2.0.4 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe ENOENT
npm ERR!
npm ERR! Failed at the nodemon@2.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PC\AppData\Roaming\npm-cache\_logs\2020-07-01T14_10_55_492Z-debug.log

【问题讨论】:

标签: node.js npm


【解决方案1】:

这是 PC/Windows 上的常见问题;

试试:

  1. 删除 package-lock.json 和 node_modules 文件夹。
  2. 从应用的根文件夹运行“npm install”。
  3. 运行“npm install -g nodemon”

【讨论】:

  • @Bush ,你能提供更新问题的解决方案吗
  • 当然!我会尝试卸载并重新安装节点。但是你能同时发布你的 package.js 的片段吗?另外,什么时候抛出这个错误?当您运行“npm start ...”或使用“npm install ...”时
  • 当我运行 npm install -g nodeman 然后与 npm start 相同时出现问题,我没有打扰我的 package.json 。 "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" 是的,试过卸载重装还是一样的问题
  • 您是否构建了它们(npm run build)?
猜你喜欢
  • 2016-08-14
  • 1970-01-01
  • 2018-07-31
  • 1970-01-01
  • 1970-01-01
  • 2019-08-11
  • 2017-12-07
  • 2016-02-22
  • 2019-05-27
相关资源
最近更新 更多