Friday, October 24, 2025
HomeLanguagesJavascriptNode.js Automatic restart Node.js server with nodemon

Node.js Automatic restart Node.js server with nodemon

We generally type following command for starting NodeJs server:

node server.js

In this case, if we make any changes to the project then we will have to restart the server by killing it using CTRL+C and then typing the same command again.

node server.js

It is a very hectic task for the development process.

Nodemon is a package for handling this restart process automatically when changes occur in the project file.

Installing nodemon: nodemon should be installed globally in our system:

Windows system: npm i nodemon -g
Linux system: sudo npm i nodemon -g 

Now, let’s check that nodemon has been installed properly to the system by typing the following command in terminal or command prompt:

nodemon -v

It will show the version of nodemon as shown in the below screenshot.

Starting node server with nodemon:

nodemon [Your node application]

Now, when we make changes to our nodejs application, the server automatically restarts by nodemon as shown in the below screenshot.

In this way with nodemon server automatically restarts.

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS