What is Nodemon Package?

What is Nodemon Package?

·

3 min read

Hi, I'm Subham Maity, a software engineer. I also enjoy teaching others how to code through my tutorials. I'm always eager to learn new things and share my knowledge with the community.

⚡ I recently wrote an article on What is Nodemon Package and wanted to share it with you all. You can find the article on my website https://codexam.vercel.app/docs/node/node1 [Better View]

⚡ I also have a repository on GitHub where you can find all the code and projects related to this topic. You can find the repository at https://github.com/Subham-Maity/node-js-full-stack-tutorial

❗ For a more in-depth look at this topic, including a detailed table of contents, check out the complete tutorial on my GitHub Repo

If you want to stay updated with my latest projects and articles, you can follow me on:

Suppose you made a change in your code and you want to see the changes in your browser. You have to stop the server and start it again. This is a very time-consuming process. So, to avoid this, we use the nodemon package. Nodemon is a package that automatically restarts the node application when file changes in the directory are detected.

⭐ How to Install Nodemon Package

  1. First, search for the nodemon package in the npm website. Then, click on the link to go to the npm website.
  • Copy the installation command from the npm website npm i nodemon

  • If you add -g at the end of the command, it will install the package globally. So you can use it in any project. npm i nodemon -g

If you are using mac or linux you have to add sudo before the command. sudo npm i nodemon -g

  1. Now, open your terminal and go to the project directory. Then, paste the command in the terminal and press enter.

  2. Now, you can see the nodemon package in the package.json file.

  3. Now you can use the nodemon package in your project. You can use the nodemon package in two ways.

  • You can use the nodemon package in the package.json file. You can add the nodemon package in the scripts section of the package.json file. Then, you can use the nodemon package by running the command npm run dev.
       {
          "scripts": {
             "start": "node app.js",
             "dev": "nodemon app.js"
           },
       }
  • You can use the nodemon package in the terminal. You can use the nodemon package by running the command nodemon app.js or nodemon app.js -e js,html,css (if you want to use nodemon for multiple file types).
  1. Now if you make any changes in your code, nodemon will automatically restart the server.