2

I got a http 407 error while running npm install behind a corporate proxy.

I've already set the proxy in environment variables like this:


    export http_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr
    export https_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr

I also edit my ~/.npmrc config to add my proxy:

registry=https://xxxxxx/artifactory/api/npm/proxy-npm/
_auth="my_base64_auth_here="
email=geraud.xxx@xxxxxxxx.fr
always-auth=true
cafile=/home/geraud/chain_bundle.pem
strict-ssl=false
proxy=http_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr
https-proxy=http_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr

And finally I run

npm set registry xxxx
npm set proxy http_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr
npm set https_proxy http_proxy://usernamewithoutspecialchars:passwdwithoutspecialchars@my.proxy.fr

But none of these methods works for me. I even run directly npm install --registry xxx --proxy xxxx but still not working.

I reproduce the issue with wget and curl by running

curl -IL --proxy-user xxxx:xxxxxx https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node

wget -d -v --proxy-user=xxxxx --proxy-password=xxxx https://nodejs.org/download/release/v8.11.4/node-v8.11.4-headers.tar.gz

Both give me 407 error. But when I run the curl with the --digest argument, then its run sucessfully.

Here is my error logs:

npm i
> node-sass@4.9.0 install /home/geraudbonou/observations/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node": 

tunneling socket could not be established, statusCode=407

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080
.....

gyp verb download using proxy url: "http://xxx:xxxx@xxx.proxy.xxx.xxx:8080/"
gyp WARN install got an error, rolling back install
gyp verb command remove [ '8.11.4' ]
gyp verb remove using node-gyp dir: /home/geraudbonou/.node-gyp
gyp verb remove removing target version: 8.11.4
gyp verb remove removing development files for version: 8.11.4
gyp ERR! configure error 
gyp ERR! stack Error: tunneling socket could not be established, statusCode=407
gyp ERR! stack     at ClientRequest.onConnect (/home/geraudbonou/observations/node_modules/tunnel-agent/index.js:166:19)
gyp ERR! stack     at Object.onceWrapper (events.js:319:30)
gyp ERR! stack     at emitThree (events.js:136:13)
gyp ERR! stack     at ClientRequest.emit (events.js:217:7)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:474:11)
gyp ERR! stack     at emitOne (events.js:116:13)
gyp ERR! stack     at Socket.emit (events.js:211:7)
gyp ERR! stack     at addChunk (_stream_readable.js:263:12)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:250:11)
gyp ERR! stack     at Socket.Readable.push (_stream_readable.js:208:10)
gyp ERR! System Linux 4.18.0-25-generic
gyp ERR! command "/usr/bin/node" "/home/geraudbonou/observations/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/geraudbonou/observations/node_modules/node-sass
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Géraud Willing B-S
  • 273
  • 1
  • 2
  • 17
  • This one is similar to this issue, https://stackoverflow.com/questions/42371380/npm-err-error-connect-econnrefused – Humble Bee May 21 '21 at 07:06

1 Answers1

0

I googling to change proxy but not working for me

On Windows, you can try cmd with administrator, it work as well

bravohex
  • 966
  • 13
  • 21