I am running my nodejs app by npm start
I just installed nodemon by
sudo npm install -g nodemon
so that i can get my server restarted when i s
In my case, I had to install nodemon globally. Use this command to do so..
npm install -g nodemon
If you're using Linux you may need to prefix the command with the sudo keyword for administration access..
sudo npm install -g nodemon
If you are using express4, the easiest way is to navigate to package.json and change
"scripts": {
"start": "node ./bin/www"
}
to
"scripts": {
"start": "nodemon ./bin/www"
}
thanks you need to type this after to enter in the folder application with
cd your_project_folder
sudo nodemon bin/www
Use single quotation
for multi-value args like `--exec'.
e.g. I changed "nodemon --exec yarn build-langs"
to "nodemon --exec 'yarn build-langs'"
and worked.
Add following code in your code
app.js
app.listen(3000, function(){
console.log("info",'Server is running at port : ' + 3000);
});
package.json
nodemon app.js
Then run npm start
from the command line.
For Express 4; Just run
nodemon
command (with out any args) on the directory; this works for me.