nodemon does not restart server, stuck on ---> [nodemon] restarting due to changes...
See original GitHub issue- Versions:
nodemon -v:2.0.15- Operating system/terminal environment (powershell, gitshell, etc): node@v16.13.0, win32@10.0.19043 / Git Bash
- Using Docker? What image: No
- Command you ran: npm start
Expected behaviour
Expected behavior is nodemon restarting the server after saving changes in the js/json files.
server.js file
const http = require('http');
const server = http.createServer((req, res) => {
res.setHeader('Content-type', 'text/plain');
res.write('Hello');
res.end();
});
const PORT = 3000
server.listen(PORT, () => console.log(`Server is running on port ${PORT}`));
package.json
{
"name": "nodejs",
"version": "1.0.0",
"description": "learn HTTP",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/JoeyFlaum/Node.js.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/JoeyFlaum/Node.js/issues"
},
"homepage": "https://github.com/JoeyFlaum/Node.js#readme",
"devDependencies": {
"nodemon": "^2.0.15"
}
}
Actual behaviour
$ npm start
> nodejs@1.0.0 start
> nodemon server.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
Server is running on port 3000
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
Steps to reproduce
-
Start the server with
npm startcommand. -
save either the package.json file or server.js file
-
nodemon does not restart the server.
If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.
> nodejs@1.0.0 start
> nodemon --dump server.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
--------------
node: v16.13.0
nodemon: 2.0.15
command: C:\Program Files\nodejs\node.exe D:\Joey\WebDev\NodeJs\node_modules\nodemon\bin\nodemon.js --dump server.js
cwd: D:\Joey\WebDev\NodeJs
OS: win32 x64
--------------
{
run: false,
system: { cwd: 'D:\\Joey\\WebDev\\NodeJs' },
required: false,
dirs: [ 'D:\\Joey\\WebDev\\NodeJs' ],
timeout: 1000,
options: {
dump: true,
ignore: [
'**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**',
re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
],
watch: [ '*.*', re: /.*\..*/ ],
monitor: [
'*.*',
'!**/.git/**',
'!**/.nyc_output/**',
'!**/.sass-cache/**',
'!**/bower_components/**',
'!**/coverage/**',
'!**/node_modules/**'
],
ignoreRoot: [
'**/.git/**',
'**/.nyc_output/**',
'**/.sass-cache/**',
'**/bower_components/**',
'**/coverage/**',
'**/node_modules/**'
],
restartable: 'rs',
colours: true,
execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
stdin: true,
runOnChangeOnly: false,
verbose: false,
signal: 'SIGUSR2',
stdout: true,
watchOptions: {},
execOptions: {
script: 'server.js',
exec: 'node',
args: [],
scriptPosition: 0,
nodeArgs: undefined,
execArgs: [],
ext: 'js,mjs,json',
env: {}
}
},
load: [Function (anonymous)],
reset: [Function: reset],
lastStarted: 0,
loaded: [],
watchInterval: null,
signal: 'SIGUSR2',
command: {
raw: { executable: 'node', args: [ 'server.js' ] },
string: 'node server.js'
}
}
--------------
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Nodemon stuck at "restarting due to changes..." and won't ...
First thing first, a proper restart-and-transpile process (since it's built using ES6 modules syntax). This is my folder structure: - src |- ...
Read more >Nodemon stuck at "[nodemon] restarting due to changes" #1915
Try running nodemon version 2.0.7. It fixed my problem.
Read more >nodemon is not restarting due to changes - Treehouse
I install nodemon <npm install -g nodemon>, I get the console message that all is going ok but when I change something in...
Read more >nodemon not restarting Code Example
how to restart nodemon. ... nodemon is not working only just showing [nodemon] restarting due to changes... ... Which command will you run...
Read more >Automatically Restart Node Apps on File Change with nodemon
Nodemon allows you to automate the process of restarting Node applications when you make changes to the underlying files. This isn't an issue ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I added the variables below to Path in system variables and it fixed the problem for me
C:\Windows; C:\Windows\system32; C:\Windows\System32\WbemI tried PowerShell and CMD. Does the same thing…