When installing, install npm install modules do not install them and give an error

 npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v6.10.0 npm ERR! npm v3.10.10 npm ERR! code ECONNRESET npm ERR! network tunneling socket could not be established, statusCode=400 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! Please include the following file with any support request: npm ERR! D:\work\projects\Ether\npm-debug.log 

revised a lot of similar errors but it does not help either the npm config set registry http://registry.npmjs.org/ nor the rest

  • somehow Kaspersky caused such an error to me - Duck Learns to Take Cover
  • @ Duck Learning I don’t have antivirus software - ItsMyLife
  • Run as administrator? - Dmitry Kozlov
  • On the other hand, he writes about the lack of a network. Maybe the network for which thread corporate firewall? - Dmitry Kozlov
  • @DmitryKozlov started up with administrator rights, it also doesn’t work from the home network, although my colleague is fine - ItsMyLife

1 answer 1

Get it your home directory instead.

sudo npm config set prefix ~/npm

The path to your environment variables ...

# open your .bashrc (Linux) or .bash_profile (Mac) file for editing:

 nano ~/.bashrc # for Linux 

or ...

nano ~ / .bash_profile # for Mac if you have not created a .bashrc file

# add these lines:

 export PATH="$PATH:$HOME/npm/bin" export NODE_PATH="$NODE_PATH:$HOME/npm/lib/node_modules" 

save the changes take effect:

 . ~/.bashrc 

# or ...

 . ~/.bash_profile 

** you have previously been installed in ~/.npm. Anything that was previously installed will be installed later. *

# optionally check to see if anything is owned by root:

 ls -la ~/.npm 

# take ownership of your ~ / .npm directory (must be run with sudo):

 sudo chown -R $USER:`id -g -n $USER` ~/.npm 

Reinstall your global packages ... this time without sudo!

# no sudo necessary :)

 npm install -g bower npm install -g grunt-cli npm install -g gulp npm install -g yo 
  • 3
    Please add an explanation: what exactly will happen as a result of the execution of this command; and how this will solve the problem indicated in the question. - yar85