Search code examples
javascriptnode.jsnpmnodemon

Nodemon wont refresh my server after i've made changes to the server code


nodemon wont run my file again after i've made changes to it. nodemon says restarting but then it doesn't?

i've tried putting the nodemon command into npm start and using the -L flag but it doesn't work. my file is code for a server if that's relevant.

this is what the terminal looks like after running npm start and changing the file

❯ npm start

> node-farm@1.0.0 start
> nodemon -L

[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
Listening to requests at port 8000
[nodemon] restarting due to changes...

but the changes dont reflect

this is what a portion of my package.json looks like

"main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon -L"
  },

"devDependencies": {
    "nodemon": "^2.0.22"
  }

Edit: I've now tried Version 2.0.7, 2.0.13, debug version and version 2.0.2 none of them work. I've tried uninstalling nodemon and reinstalling it too, but still stuck at

❯ nodemon index.js
[nodemon] 2.0.14-alpha.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
Listening to requests at port 8000
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...

Solution

  • I Solved it!

    Turns out i had to add C:\Windows and C:\Windows\System32

    to my PATH variable. My problem is now solved!