Nodemon #ftw. In Windows Forever, it doesnβt actually look at files as often as they accidentally watch them, and pm2 restarts the server every time you load a page.
Each of these tools works the same way, and each is installed in the same way as in the accepted answer. For instance:.
npm install nodemon -g
This installs nodemon globally, and for use you can simply go to the project folder and type:
nodemon
(Assume your project has an app.js file). You can add the -w switch, as in Forever and pm2, however, if you just want to see all the files, you can omit this. To run nodemon in the background with Forever, you run this:
forever nodemon --exitcrash
Nodemon is good for development, especially on Windows, and Forever and pm2 are more for production on Linux.
source share