Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
777 views
in Technique[技术] by (71.8m points)

node.js - I can´t install nodemon globally, "nodemon" not recognized

I want to use nodemon for monitoring my node.js app's, then I execute the next line command:

npm install -g nodemon 

or

npm install nodemon -g

When I move to my app folder and try to to

nodemon app.js

The system tells to the next:

"nodemon 'is not recognized as an internal or external command, program or batch file.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since node prefix is not in the PATH ENV variable , any of the globally installed modules are not getting recognized.

Please try this.

Open cmd prompt

npm config get prefix

append the resulting path to PATH env variable.

Now you should be able to run nodemon from any location.


This is what i have done on my local machine


C:>npm config get prefix
C:UsersusernameAppDataRoaming
pm

C:>set PATH=%PATH%;C:UsersusernameAppDataRoaming
pm;

C:>nodemon
 31 Jul 22:30:29 - [nodemon] v0.7.8
 31 Jul 22:30:29 - [nodemon] to restart at any time, enter `rs`
 31 Jul 22:30:29 - [nodemon] watching: C:
 31 Jul 22:30:29 - [nodemon] starting `node `
 ^CTerminate batch job (Y/N)? Y

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...