問題描述
npm install throws 和錯誤告訴 node 不是一個可識別的命令 (npm install throws and error telling node is not a recognized command)
我已將節點添加到 PATH。
我已嘗試重新安裝節點並重新啟動系統。
節點 ‑‑version = 6.13.7
npm ‑‑version = 12.14.1
參考解法
方法 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:
- Did you add it to User Path or System Path?
- 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/
- Have you added Git to your Path as well? If not, go ahead and install Git Bash: https://gitforwindows.org/
- 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
- 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)