Running npm install -g yo command gives ->“npm ERR

2019-08-09 07:16发布

问题:

npm -v: 3.5.3

I am very new in npm, when i am running npm install -g yo ,getting error like this:

npm ERR! Windows_NT 6.1.7601

npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\sougata.a\AppDa ta\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "yo" npm ERR! node v5.5.0 npm ERR! npm v3.5.3 npm ERR! path C:\Program Files\nodejs\node_modules.staging npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall mkdir npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\n ode_modules.staging' npm ERR! at Error (native) npm ERR! { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\node js\node_modules.staging'] npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'mkdir', npm ERR! path: 'C:\Program Files\nodejs\node_modules\.staging' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

I don't have and proxy setting, and I disabled firewall and antivirus. if i run npm cache clean same error is coming!!

can anyone help me???

回答1:

This is how I solved the issue on Windows 8.1

  • Go to your nodejs install (usually C:\Program Files\nodejs)
  • Right click node_modules folder and go to properties
  • Click the Security tab and advanced
  • At the top you will see "Owner: SYSTEM". Click change.
  • Enter the user you want permissions for and click ok
  • Check the box at the bottom of the advanced settings "Replace all child object permission entries with inheritable permission entries from this object" and click ok
  • Do whatever npm install/update you need


回答2:

Do you use a proxy? and did you find these entry here seems to be the same problem with an other module. https://github.com/npm/npm/issues/8048

I had similar errors

npm ERR! Windows_NT 6.1.7601 ... and I had to turn off my Firewall and AntiVir

also this one here https://forums.tessel.io/t/error-using-npm-install-on-windows/212 there are a lot solutions for this problem what did you tried so far?

But it seems the directory that npm installs into is not on your path.

Did you try this stuff

When I did it on Windows, I then had to launch the 'node command shell' or whatever it's called. Basically, if you're on windows 8, and you search for 'node', you should see one item that is a command shell configured to run node. It has the standard 'cmd' looking black terminal icon.

Not to be confused with the 'node shell', which has the node.js logo. that one is an interactive REPL for node, which is NOT what you want to be in.

The command shell has the right path stuff already setup. If you just run a regular command shell, or PowerShell, the path won't be configured, unless you go into the system and configure it yourself.

Are you new to node or is this bug just happening in development? Maybe you should add your package json