nodemon使用报错restarting due to changes...建议改用supervisor

困扰了我两天了的一个问题,下面是我的使用过的方法

1.重启(没啥用)

2.重装nodemon,再删掉之后全局安装和本地安装

3.重装node

4.添加系统环境变量详见(https://blog.csdn.net/Vrainy/article/details/107268357)

这个没解决我的问题,但是说不定能解决你的问题

5.安装supervisor

说回报错原因,其实到现在我都不知道,可能是nrn或者是Gulp的原因。但是只是可能,毕竟我也做了一点别的事情。

总之,难以解决,又不想浪费太多时间,毕竟这个错误有点不知所措…

安装supervisor过程和nodemon差不太多

1.npm install -g supervisor

2.supervisor app.js

这是nodemon的报错

[nodemon] restarting due to changes...
(node:19504) UnhandledPromiseRejectionWarning: Error: Command failed: wmic process where (ParentProcessId=3056) get ProcessId 2> nul
    at checkExecSyncError (child_process.js:643:11)
    at execSync (child_process.js:679:15)
    at kill (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:345:26)
    at Function.run.kill (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:437:7)
    at Bus.<anonymous> (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:507:7)
    at Bus.emit (events.js:387:35)
    at restartBus (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\watch.js:228:7)
    at FSWatcher.filterAndRestart (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\watch.js:212:16)
    at FSWatcher.emit (events.js:375:28)
    at FSWatcher.emitWithAll (C:\Users\Devil\AppData\Roaming\npm\node_modules\nodemon\node_modules\chokidar\index.js:540:8)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19504) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19504) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate 
the Node.js process with a non-zero exit code.

这是supervisor的执行结果,亲测好用,建议新手遇到nodemon的上述错误不要过分纠结,先使用这个进行替代,毕竟组建的更迭或者是更深的问题新手总之有些乏力,反而会影响继续的学习热情,所以建议先使用supervisor。nodemon使用报错restarting due to changes...建议改用supervisor_第1张图片

你可能感兴趣的:(node,nodemon,supervisor,npm,nodejs,bug)