Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLido Fernandez
10,556 Pointsnodemon is not restarting due to changes
I install nodemon <npm install -g nodemon>, I get the console message that all is going ok but when I change something in my app.js file the server does not restart.
here there is the app.js file
'use strict';
var express = require("express"); var posts = require('./mock/posts.json');
var app = express();
app.get("/", function(req, res){ res.send("<h1>I lo bananas yeah!!</h1>"); });
app.get('/blog', function(req, res){ res.send(posts); });
app.listen(3000, function(){ console.log("it is all ok"); });
3 Answers
Charles Meehan
20,474 PointsAlright, so after a little bit of research I found there was a some issues with nodemon regarding automatic restarts and exiting ports.
I found an alternative that works just as well called supervisor.
The commands you would use are: $ npm install supervisor -g $ supervisor src/app.js
Hope this works for you guys!
Here's where I found it http://www.hacksparrow.com/node-js-restart-on-file-change.html
Allison Walker
17,137 PointsThanks this works for me, too.
Joshua Britton
10,252 PointsHad the same problem with nodemon about 11 months after your original post. Nodemon's current version is 1.10.1 & reverting back to 1.10.0 as suggested here in this GitHub issues post solved the problem for me.
First I uninstalled nodemon:
npm uninstall nodemon
Then reinstalled 1.10.0:
npm install -g nodemon@1.10.0
Brendan Moran
14,052 PointsThank you, thank you, thank you! I wish I could give you best answer. I was having this same problem at the exact same time as you! So glad I found this. :)
Lido Fernandez
10,556 PointsHi Paul,
I've just gave up. I will try next week again cuz I think the tool is very important.
Jerome Doyle
8,855 Pointsdid you insatll nodemon correctly?
if not try
(sudo npm install -g nodemon
)
George Akinian
17,615 PointsGeorge Akinian
17,615 Pointswhere you able to solve this?