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)

nodemon: command not found

Hi all,

It seems I am able to successfully install nodemon. I get the following information after install:

nodemon@1.4.1 /home/twoscoops/npm/lib/node_modules/nodemon
├── minimatch@0.3.0 (sigmund@1.0.1, lru-cache@2.6.5)
├── touch@1.0.0 (nopt@1.0.10)
├── ps-tree@0.0.3 (event-stream@0.5.3)
└── update-notifier@0.3.2 (is-npm@1.0.0, string-length@1.0.1, chalk@1.1.1, semver-diff@2.0.0, latest-version@1.0.1, configstore@0.3.2)

When I try to open app.js using nodemon src/app, I get the message "nodemon: command not found"

I tried setting a PATH in the profile and bash but I get the same results. I tried Google but I am still unable to find a solution. I am on Ubuntu. Please advise. I appreciate any assistance, thanks.

5 Answers

Remove the ampersand (&) from the export and that should properly add it to the end of the existing PATH variable:

export PATH=$PATH:~/npm
printf "%s\n" "$PATH"

Maybe try switch to the root user with sudo su - and then add to the PATH, and then do the global install (won't need sudo then of course):

sudo su -
export PATH=$PATH:/home/twoscoops/npm
npm install -g --force nodemon
evvvv
evvvv
16,796 Points

Iain - THANK YOU, THANK YOU, THANK YOU!! This problem was killing me, thank you for the solve!!!

That totally WORKED! Awesome! Thank you man I appreciate all the help. You rock. This bugger has been bothering me all day haha. Have a good one

Fábio Tavares da Costa
Fábio Tavares da Costa
11,985 Points

Thanks!

sudo su -
export PATH=$PATH:/home/USER/npm
npm install -g --force nodemon

# THESE LINES + START FROM A NEW TERMINAL...
# IN MY CASE

npm install -g --force node-inspector

# TOO

Solved!

You save my life :) It is really helped me. Thank you a lot!

First, make sure you installed nodemon globally, and with sudo:

sudo npm install -g nodemon

Second check that the PATH contains the correct directory using the following:

npm config get prefix

This will tell you what should be added to the PATH.

Thanks for the response. I definitely installed globally with sudo. This is what I get in full after install:

/home/twoscoops/npm/bin/nodemon -> /home/twoscoops/npm/lib/node_modules/nodemon/bin/nodemon.js nodemon@1.4.1 /home/twoscoops/npm/lib/node_modules/nodemon ├── minimatch@0.3.0 (sigmund@1.0.1, lru-cache@2.6.5) ├── touch@1.0.0 (nopt@1.0.10) ├── ps-tree@0.0.3 (event-stream@0.5.3) └── update-notifier@0.3.2 (is-npm@1.0.0, string-length@1.0.1, chalk@1.1.1, semver-diff@2.0.0, latest-version@1.0.1, configstore@0.3.2)

I used npm config get prefix and got the following:

/home/twoscoops/npm

I used export PATH=$PATH:&~/npm and then echo $PATH and got /home/twoscoops/npm back. I'm still getting nodemon: command not found though.. Am I making a syntax error? Or do I have to directly modify the profile?