简体   繁体   中英

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

Been at this for hours, for some reason npm suddenly broke, was working yesterday without issues but today it throws me this error, I have messed with path and read through any help article on this issue but all of them don't seem to fix the issue. I've updated (was on 14.xx and updated to the latest version of 14.xx). uninstalled/reinstalled, all to no change. Running npm.cmd or npx.cmd works, but runs into issues when installing any package as it tries to run npm rather then npm.cmd while installing. In the command prompt node works perfectly, I can run node -v etc without issues, just npm and npx seem to be broken. As for some extra info C:\\Users\\NameHere\\AppData\\Roaming\\npm exists as well as C:\\Program Files\\nodejs . In the user path variables C:\\Users\\NameHere\\AppData\\Roaming\\npm exists, and in the system path variables C:\\Program Files\\nodejs\\ exists (I've also tried adding the path above to the system variables, as well as restarting the computer after each of these changes).

All I can think of is that some program is causing this but even then I'm not sure how it could be, or what would've changed from yesterday to today.

找到答案,回到环境变量,在system variables > PATHTXT我添加了;.cmd

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