What is Nodemon in NodeJS?

Aayan Ali
Dev Genius
Published in
2 min readApr 19, 2024

--

Tired of writing node again & again to run the file and get output?

So presenting you, NODEMON !!!!

What is Nodemon?

Nodemon is a module in npm that automatically runs the file when any change in the file is made so you don’t need to write “node filename” again and again to run the file just to see your change.

How to use it?

As it is an NPM module you first need to install it by writing this command in your terminal:

npm install nodemon -global

What is this “global” in the above command?

When you write global with the command or package you are installing, the package will now install in your Operating system instead of your file where you are writing the code. Now after global, you will be able to use Nodemon anywhere not just in your current file.

To confirm your installation, write this command in your terminal:

nodemon -v

It will output the version of your nodemon.

If you are getting this error :

Just to the location it has provided:

“C: Users\aayan\AppData\Roaming\npm”

In the npm folder, you will find nodemon.ps1 file, just delete that file and you are done. Now when you run “nodemon -v” you won't get any error.

After the installation, to run your code now just write nodemon and your filename :

nodemon index.js

Make any edit in your file, it will automatically show you the output without running it.

To exit nodemon press Ctrl + C.

I hope you understood the use of Nodemon and how to use it in your file.

Give it a clap and follow me for more tutorials like this.

Go to my Portfolio to connect with me:

https://aayan-ali-hashim.github.io/portfolio_website.github.io/

--

--

Hi I am Aayan Ali, I am a python developer with more than 2 years of experience