Categories
Javascript

Save time: npm install nodemon

Nodemon will allow you to start your node.js project and make changes without manually shutting down and restarting your server.

Many people are scared of installing nodemon globally, so here’s a guide to install nodemon locally in your node.js project.

Step 1: Install nodemon 

$ npm install nodemon --save

Step 2: Update your npm scripts object in package.json

"scripts": {

    ...

    "start": "nodemon index.js

}

Note: If you used the express generator you will change "nodemon index.js" to your entry point into your server, which is likely “nodemon ./bin/www"

Step 3: Run your new npm script

$ npm start

Congrats!

Now our JavaScript changes will restart your server automatically

* Note, many frameworks compile and cache templates so changing your html/jade files may not restart your server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s