Currently I already install nodemon with command npm install -g nodemon
. And I got Permissions issue, so I do command with sudo npm install -g nodemon
and i did it. But when I make "nodeman" command was always show nodemon: command not found
.

- 4,487
- 3
- 38
- 50

- 203
- 1
- 2
- 6
-
2Try `export PATH=$PATH:~/npm` – Asnim P Ansari Jun 20 '19 at 14:04
6 Answers
If for any reasons you are unable to set a Global PATH then under your current project directory, run
npm install nodemon --save-dev
then under "scripts" in your package.json file, add "start": "nodemon app.js" like this -
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon app.js"
}
then run
npm start

- 566
- 5
- 10
-
Thank u it's work for me. But I still wonder, why i've to add this "start": "nodemon app.js" on my package.json? – Slamet Riyadi Jun 21 '19 at 06:53
-
With that written, you'll be able to run "npm run start" and then the mapped script ( which is "nodemon app.js" will run). – Maulik Pipaliya Joyy Feb 10 '22 at 01:25
-
Note: npm adds ./node_modules/bin to the working path, so that scripts will be able to use executable scripts installed to the local node modules... I actually have that added to my path statement as-is, so that I can use local node module bin scripts without issue. – Tracker1 Sep 12 '22 at 19:03
If you need to install nodemon globally on mac OS, try
sudo npm install -g nodemon
.
Then you'll have to enter your password. Once the installation is completed successfully, run
nodemon -v
to check nodemon version on terminal.

- 1,302
- 14
- 20
According to this, Create a new directory to store your global
packages. So that there is no permission issue.
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
Edit your .profile or .bash_profile to add the new location to your PATH:
export PATH=~/.npm-global/bin:$PATH
Then install the package without sudo
:
npm install -g nodemon

- 12,123
- 3
- 26
- 35
If you want to install global nodemon use SUDO, because if you need to be a global user, you need to be a super user

- 1,212
- 3
- 15
- 36
The other answer is correct but my advice is that it's better to not install packages globally if you can help it, this makes your application self sufficient without relying on the environment and avoids versioning issues between applications.
npm install -D nodemon
You can now execute nodemon from scripts
in package.json:
"scripts": {
"start": "nodemon src/index.js"
}
Or you can execute it yourself using npx
if you're in that directory from the terminal. npx executes local scripts, e.g. npx nodemon --inspect ./src/index.js 8080

- 62,658
- 20
- 139
- 163
Just run these commands and the error will get solved. Specially for MAC People:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Enter your laptop password
npm install i -g nodemon or npm install -g nodemon
All set .....

- 9,772
- 9
- 21
- 34