Search code examples
node.jsnodemon

Nodemon does not auto restart


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"
  }
}

Solution

  • 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!