提问者:小点点

无法运行nodejs npm


我无法运行我的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

共1个答案

匿名用户

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

尝试:

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