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

对着背影说爱祢 提交于 2020-08-23 04:57:09

问题


I'm getting:

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

when I issue:

npm install -g bower polyserve

Even though I have downloaded node.


回答1:


I think you have not defined the path of nodejs in Environment Variables on the System Properties.

Add ;C:\Program Files\nodejs\ (path of your nodejs installed directory)

To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.

Then reopen cmd prompt and type npm again.It should work now.Hope it helps.

You can do one more thing if still it does not work.Reboot your machine after installing node.




回答2:


Set path for node.js in your environment variables. To do this:

  1. right click on MyComputer->properties->advance system setting-> Environment variables-> select & edit "Path" variable in System variables.
  2. Add C:\Program Files\nodejs\; in path
  3. Restart your command prompt
  4. Type node --version in a new console window, the version number should appear as a response.


来源:https://stackoverflow.com/questions/33055515/npm-is-not-recognized-as-an-internal-or-external-command-operable-program-or

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!