2

I have already set proxy configurations in .npmrc file. Executing the npm install command gives me error as follows"

$ npm install npm ERR! Windows_NT 6.1.7601 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.9.4 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:\Pooja\quickstart\npm-debug.log

The .npmrc file in user folder contains following values

 1. registry=https://registry.npmjs.org/
 2. proxy=http://proxy@domain.com:8080/
 3. http_proxy=http://username:password@proxy@domain.com:8080/

Is there any way to solve this issue?

Pooja Kedar
  • 439
  • 2
  • 10
  • 23
  • What does the file `D:\Pooja\quickstart\npm-debug.log` says? – Ankur Jan 24 '17 at 06:49
  • info via: 88855 verbose optional SKIPPING OPTIONAL DEPENDENCY: npm owner ls utf-8-validate 88855 verbose optional SKIPPING OPTIONAL DEPENDENCY: There is likely additional logging output above. 88856 verbose stack Error: phantomjs@1.9.7-15 install: `node install.js` 88856 verbose stack Exit status 1 88856 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) 88856 verbose stack at emitTwo (events.js:106:13) 88856 verbose stack at EventEmitter.emit (events.js:191:7) – Pooja Kedar Jan 24 '17 at 07:03

3 Answers3

2

Does your proxy URL have '@' symbol in it? @ symbol separates the user ID and password from the URL. If it does, you can try using '%40' to replace it.

Also, it is https-proxy not http_proxy.

A correct config would look like -

registry=https://registry.npmjs.org/
proxy=http://username:password@proxydomain:8080/
https-proxy=https://username:password@proxydomain:8080/

https://docs.npmjs.com/misc/config#proxy

manojtc
  • 562
  • 3
  • 10
  • npm ERR! fetch failed https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, npm ERR! fetch failed https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, npm ERR! fetch failed https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\b – Pooja Kedar Jan 24 '17 at 08:31
  • npm ERR! node v6.9.4 npm ERR! npm v3.10.10 npm ERR! code ECONNRESET npm ERR! network tunneling socket could not be established, statusCode=407 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' – Pooja Kedar Jan 24 '17 at 08:31
  • Are you able to download the file https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz through your browser from behind the proxy? Also it will help if you provide the output of the command `npm config list` (make sure you mask the password). 407 status code means your proxy did not authenticate your request. Make sure you are using a correct user id and password. Something is causing the proxy login to fail. – manojtc Jan 24 '17 at 11:53
  • Ya it is working now.Problem was with the proxy address.I had entered incorrect proxy address. @manojtc thank you – Pooja Kedar Jan 25 '17 at 07:13
1

first give the command and check if proxy is set,npm config get proxy if not set do the following from command prompt

npm config set proxy http://username:password@proxy address:8080 npm config set https-proxy http://username:password@proxy address:8080

and if password contains '@'in password, then replace it with '%40'

SU15
  • 873
  • 2
  • 11
  • 15
0

Someone who comes from china may solve this problem by using Taobao mirror.

npm --registry=https://registry.npm.taobao.org install

coldesleon
  • 11
  • 1