简体   繁体   中英

npm install throws and error telling node is not a recognized command

系统抛出节点未找到错误

I have added node to the PATH.
I have tried reinstalling node and restarting the system.
node --version = 6.13.7
npm --version = 12.14.1

Whenever your PC can't pick up on node as a command, it's usually a PATH issue.

I note that you say you have already added it to Path, but it's worth checking a few things:

  1. Did you add it to User Path or System Path?
  2. How long is your Path parameter? If it's too long, you may need to break it down into two or more variables. Reference here: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
  3. Have you added Git to your Path as well? If not, go ahead and install Git Bash: https://gitforwindows.org/
  4. If restarting hasn't done the trick of refreshing your env variables for whatever reason, you can force it along by opening Powershell as admin, and running refreshenv
  5. If you are able to run node commands, but npm isn't able to run them on your behalf, it may be a permissions issue. Consider running the very same command, but in an elevated permissions CMD. (Run CMD as admin)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM