Nodemon不会自动重新启动

发布于 2025-02-10 18:08:59 字数 717 浏览 3 评论 0原文

我已经安装了Nodemon(到项目目录或全球),但是当我对代码进行更改并保存时,它不会自动重新启动。 VS代码中的终端显示“ [nodemon]由于更改而重新启动...”,但是当我保存更改时,它才会停留在那里。

曾尝试过不同版本的nodemon并重新安装我的nodejs,但仍然不起作用。

这是我的包装。JSON和目录:

.. \ mainfolder \ signitment_1 \ package.json

.. \ mainfolder \ signitment_1 \ app.js

{
  "name": "assignment_1",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
  },
  "author": "user1",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.18"
  }
}

I have installed nodemon (onto to project directory or globally) but it does not auto restart when I make changes to my code and save it. The terminal in vs code shows '[nodemon] restarting due to changes...' but it just stuck there when I saved my changes.

Had tried different versions of nodemon and reinstall my nodejs but still doesn't work.

This is my package.json and the directory:

..\mainfolder\Assignment_1\package.json

..\mainfolder\Assignment_1\app.js

{
  "name": "assignment_1",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
  },
  "author": "user1",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.18"
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对你而言 2025-02-17 18:08:59

对于像我这样的Windows用户,我在用户变量中添加了Path变量的以下值:

%SystemRoot%\ System32;%SystemRoot%;%SystemRoot%\ System32 \ wbem;

重新启动与代码,对我有用!

For Windows users like me, I have added in User Variable the following value for PATH variable:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\wbem;

Restarts VS code and it works for me!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文