问题
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:
- right click on MyComputer->properties->advance system setting-> Environment variables-> select & edit "Path" variable in System variables.
- Add
C:\Program Files\nodejs\;in path - Restart your command prompt
- Type
node --versionin 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