'CALL “C:\Program Files\nodejs\\node_modules \npm\bin\npm-cli.js” prefix -g' is not recognized as an internal or external com mand,

蹲街弑〆低调 提交于 2021-02-05 11:26:08

问题


C:\Users\MNE GO DIGITAL>npm
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules
\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external com
mand,

operable program or batch file.

i have installed nodejs on c drive when i hit npm --v also it state this same error

C:\Users\MNE GO DIGITAL>npm
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules
\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external com
mand,

operable program or batch file.

please find attachment for more clarification

Error in executing npm on windows 7


回答1:


I just spend way to long with this issue. I'm not sure how it got set, perhaps during an install, but I changed a System Variable:

Name: ComSpec Value: %SystemRoot%\system32\cmd.exe;prefix=C:\Program Files (x86)\nodejs\node.exe

To this:

Name: ComSpec Value: %SystemRoot%\system32\cmd.exe

And restarted my system and the issue was gone.




回答2:


@selva, For start some server with npm, you can use

npm start

A package can be downloaded with the command

npm install <package_name>

For install globally use -g after package name.

If there is no package.json file in the local directory, the latest version of the package is installed.

If there is package.json file, the latest version satisfying the semver rule declared in package.json for that package (if there is any) is installed.

npm only, does not anything. The command wait for something to do, install, help, etc.

If the problem with command npm --v continuous, try uninstall and install again.

Check this solution:

I saw your problem is with npm-cli, You need to Add C:\Program Files\nodejs to your PATH environment variable. To do this follow these steps:

Go to control panel -> System -> Advanced System Settings then environment variables.

  • Use the global Search Charm to search "Environment Variables"
  • Click "Edit system environment variables"
  • Click "Environment Variables" in the dialog.
  • In the "System Variables" box, search for Path and edit it to include C:\Program Files\nodejs. Make sure it is separated from any other paths by a ;. You will have to restart any currently-opened command prompts before it will take effect.

See more at official documentation here.



来源:https://stackoverflow.com/questions/43312904/call-c-program-files-nodejs-node-modules-npm-bin-npm-cli-js-prefix-g-is

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