I've recently reinstalled node package manager npm install nodemon -g
which grabbed the latest build. But when I run nodemon server.js
and I save changes to files, it's extremely slow to restart the server. It might take 10-30 seconds to detect file changes and when the restart process executes, it can take a few seconds to finish. I'm using nodemon 1.17.3. I don't have this problem on my other build (same PC and same local parent directory) that's using nodemon 1.14.8. Has anyone else experienced this?
nodemon is slow to restart the server
Asked Answered
which OS? are you running it inside a docker container? –
Dressler
Windows 10. No docker, just localhost. Actually I rolled back to nodemon 1.14.8 and the problem went away. –
Schnorr
Also happening in Ubuntu 18.04LTS, nodemon 1.18.10 –
Filmer
it is also happening to me as well..does anyone have a fix for this? [email protected] does not work for me. im on windows10 btw –
Alleras
I have the same issue with nodemon 2 (2.0.20) on windows 10 (10.0.19041.2364) –
Arrhenius
There can be several reasons for the slow server restart. Here are few things you can try
Exclude unnecessary files which doesnt require monitoring from nodemon
Create a nodemon.config.js
file and add the files you dont want nodemon to check while restarting the server
ex:
{
"ignore": [
"node_modules",
"public"
]
}
Or
to check only the changed files you can specify nodemon which files to monitor while restarting the server by --watch
flag
nodemon --watch src/user.model.js
You can also increase the amount of memory available to Node. If your server is slow due to memory limitations you can make the maximum amount of memory availbale (in megabites) by
nodemon --max-old-space-size=4096 app.js
I hope this helps.
One can check more about it at: nodemon.io –
Promotive
© 2022 - 2024 — McMap. All rights reserved.