nodemon not working: -bash: nodemon: command not found
Solution 1
I tried the following, and none worked:
npm uninstall nodemon
sudo npm uninstall -g nodemon
What did work was:
sudo npm install -g --force nodemon
Solution 2
If you want to run it locally instead of globally, you can run it from your node_modules:
npx nodemon
Solution 3
From you own project.
npx nodemon [your-app.js]
With a local installation, nodemon will not be available in your system path. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as npm start
) or using npx nodemon
.
OR
Create a simple symbolik link
ln -s /Users/YourUsername/.npm-global/bin/nodemon /usr/local/bin
ln -s [from: where is you install 'nodemon'] [to: folder where are general module for node]
node : v12.1.0
npm : 6.9.0
Solution 4
I'm using macOS/Linux, the solution that works for me is
npx nodemon index.js
I have tried every possibility, like uninstalling and installing nodemon, installing nodemon globally. restart the terminal, but it won't work.
don't try such things to waste your time.
Solution 5
in Windows OS run:
npx nodemon server.js
or add in package.json config:
...
"scripts": {
"dev": "npx nodemon server.js"
},
...
then run:
npm run dev
Related videos on Youtube
Comments
-
Brian O'Neill almost 2 years
I'm on a Mac running El Capitan. I have node v5.6.0 and npm v3.6.0. When I try to run nodemon, I get:
-bash: nodemon: command not found
I thought this may mean that I didn't have nodemon installed, so when I tried to install it using...
sudo npm install -g nodemon
...I get this:
npm ERR! Darwin 15.2.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "nodemon" npm ERR! node v5.6.0 npm ERR! npm v3.6.0 npm ERR! path /usr/local/bin/nodemon npm ERR! code EEXIST npm ERR! Refusing to delete /usr/local/bin/nodemon: ../lib/node_modules/nodemon/nodemon.js symlink target is not controlled by npm /usr/local npm ERR! File exists: /usr/local/bin/nodemon npm ERR! Move it away, and try again. npm ERR! Please include the following file with any support request: npm ERR! /Users/brianeoneill/npm-debug.log
If it makes a difference, I'm trying to run nodemon on a project that uses Express v4.13.1
Thanks for any help you can offer!
-
Sterling Archer about 8 yearsHave you uninstalled nodemon before trying to install it again globally?
npm uninstall nodemon
-
Brian O'Neill about 8 yearsI tried that and it didn't work. However, I just tried sudo npm install -g --force nodemon, and that seemed to do the trick. Thanks for your help!!!!!
-
Sergey Andreev over 6 yearsMay be my solution helps you ;) stackoverflow.com/questions/46505121/…
-
-
Jinesh about 8 yearswatch the following video from official docs site docs.npmjs.com/getting-started/fixing-npm-permissions . Will give you better insight about the issue.
-
Russo over 5 yearsor add this line if you use yarn: export PATH="$(yarn global bin):$PATH"
-
MJ Montes almost 5 years--save is no longer needed after npm v5
-
jerseyetr almost 5 yearsEDIT: sadly i have to use this command each and everytime i want to run my program instead of it installing nodemon locally.
-
Dostonbek Oripjonov over 4 yearsrecommendation to delete package : 1 - Remove line from package.json 2 - and type this command " node prone "
-
Didierh almost 3 yearsThis works on Mac OSx like charm! Thank you!
-
Mohammad Afzali over 2 yearsWorked like a charm! Thanks. (I use ubuntu 20.04)
-
Janib Soomro over 2 yearsWorked for me as well. Thanks.
-
Atif Mahmood almost 2 yearssolved thanks for complete solution