Nodemon crashes :TypeError: Cannot read property '__nodemonRestart' of null

Nodemon crashes :TypeError: Cannot read property '__nodemonRestart' of null

我使用 Nodemon 运行 我的代码 Node.js (VS Code IDE)。我只是一个初学者,需要一些指导来解决这个问题。每次代码出错时,Nodemon 都会崩溃(我在 VS Code 中选择了自动保存选项)。错误如下:

at Function.Module._load (internal/modules/cjs/loader.[nodemon] app crashed - waiting for file changes before starting...
C:\Users\bobsa\AppData\Roaming\npm\node_modules\nodemon\lib\monitor\run.js:149
      if (child.__nodemonRestart) { // this flag is set right before the kill
                ^

TypeError: Cannot read property '__nodemonRestart' of null

我是否必须更改 run.js 文件中的“__nodemonRestart”?我已经用最新版本更新了nodemon,但问题是一样的。

当我将 nodemon 更新到版本 2.0.1 时,它也发生在我身上。你可能想回到你的旧时代。通过运行这行代码npm i -g nodemon@your.old.version,例如npm i -g nodemon@1.19.4(这只是一个例子)

版本历史

2.0.1........................ 11 days ago

2.0.1-alpha.3........................ 12 days ago

2.0.1-alpha.2........................ 12 days ago

2.0.1-alpha.1........................ 12 days ago

2.0.0........................ 13 days ago

1.19.4........................ 2 months ago (this one is working fine for me)

1.19.3........................ 2 months ago

1.19.2........................ 3 months ago

1.19.1........................ 6 months ago

1.19.0........................ 7 months ago

1.18.11........................ 8 months ago

编码愉快!!!!!