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 trial

JavaScript Express Basics (2015) Developing Express Apps Like a Boss Easily Debug Express (and other node apps)

Lido Fernandez
Lido Fernandez
10,556 Points

nodemon 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"); });

where you able to solve this?

3 Answers

Alright, 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

Thanks this works for me, too.

Had 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
Brendan Moran
14,052 Points

Thank 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
Lido Fernandez
10,556 Points

Hi Paul,

I've just gave up. I will try next week again cuz I think the tool is very important.

did you insatll nodemon correctly?

if not try (sudo npm install -g nodemon)