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 User Authentication With Express and Mongo User Registration Using Nodemon While Developing an Express App

Any solution for nodemon throwing errors in a Windows dev environment?

When attempting to use ndoemon in a Windows environment, using either the Bash terminal (when using Atom) or the built-in terminal in PHPStorm, I'm getting a very specific error:

'\"node .\app\"' is not recognized as an internal or external command, operable program or batch file. [nodemon] app crashed - waiting for file changes before starting...

I've attempted to do some research online about this issue, and it appears to be a Windows-specific error, but I haven't come across anything yet that resolves it for this instance. I am use PHPStorm as my primary IDE (for school and real-world) and all project dependencies are installed, as well as current versions of Node and NPM. Additionally, my system and user-level paths are all correct for Node and related tools. This one really has me stumped.

In the meantime, I can still use other methods to start the app and continue with the lesson, but I wanted to make others (and Dave McFarland @davemcfarland) aware that this looks to be a somewhat common occurrence for some Windows users.

2 Answers

Ademola Adesibikan
Ademola Adesibikan
491 Points

For a quick quirky fix, Just clear the starts line from your scripts object in your package.json file and run nodemon app.js

That actually worked for me... thanks! How odd, right?

It will get the job done with Nodemon under that usage condition, but the start in scripts still needs to be there for other uses, such as express-session. It's a fast and dirty workaround, but I really wish there was a full resolution on this. Since I'm using PHPStorm, I suppose I could just continue to use the node start/stop controls to pause and restart the localhost server in between major changes.

nico dev
nico dev
20,364 Points

Hi Derek Neuts ,

Just came here and saw this and I have to say I am surprised. I am in Win 10 too, but I have been happily using nodemon intensively, and don't remember having any trouble with it.

Don't want to take anything for granted here, so I have to ask: are you sure you added node to your path? And also, you sure you are up to date with node's, npm's and nodemon's versions?

Just trying to help you enjoying it, because for me nodemon has meant salvation. :)

nico dev
nico dev
20,364 Points

Sorry, just another note that might be helpful (or not).

After asking you to check if you have everything up to date, I realized my nodemon was not fully up to date. |o|

I was using 1.11.0. When I updated, however, I jumped straight to the latest, which happens to be 1.12.1.

Now I was delving around and the fact that there were a few reports similar to what you're saying in nodemon's GitHub just a couple of weeks ago and they were pointing to the 1.12.0 makes me think that if nodemon is using semver, which I think they are, the .1 may well stand for the fix to that particular issue (can't confirm it because I can't find any release notes).

In short: try updating to 1.12.1, should be alright now. :) HTH!

For adding to PATH in windows I recommend this video:

https://www.youtube.com/watch?v=W9pg2FHeoq8

If your path variable isn't accessible after adding it, I recommend a system reboot and you should be golden.