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
416 views
in Technique[技术] by (71.8m points)

node.js - Node JS NPM modules installed but command not recognized

Node JS and NPM were working well before. Recently I have re-installed the Node JS, NPM and the problem started. After I install a module like an example npm install -g bower, the module gets installed successfully but bower -v gives

'bower' is not recognized as an internal or external command, operable program or batch file.

I have checked the installation path C:UsersXXXXXAppDataRoaming pm ode_modules has all the old installed modules. I have tried to uninstall them and reinstall the modules, but still, I am getting the same error.

Even I have deleted the entire folder and installed all the modules again but the result is the same.

I don't know why I am getting this error after reinstalling NodeJS NPM.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

I had this same problem and fixed it by adding the 'npm' directory to my PATH:

Right-click 'My Computer' and go to 'Properties > Advanced System Settings > Environment Variables'.

Double click on PATH under the 'User variables for Username' section, and add C:UsersusernameAppDataRoaming pm obviously replacing 'username' with yours. Based on the comments below, you may need to add it to the top/front of your path.

Restart your console window or IDE and you should get a response from the bower command.


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

...