Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Unable to install packages behind corporate proxy #322

Closed
marcuslindfeldt opened this issue Mar 13, 2015 · 187 comments
Closed

Unable to install packages behind corporate proxy #322

marcuslindfeldt opened this issue Mar 13, 2015 · 187 comments
Labels

Comments

@marcuslindfeldt
Copy link

I get the following error when trying to install a package with apm behind a corporate proxy.

$ apm install linter
Installing linter to /home/marcuslt/.atom/packages 
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | linux | x64
gyp http GET https://atom.io/download/atom-shell/v0.21.0/node-v0.21.0.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error 
gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error
gyp ERR! stack     at ClientRequest.onError (/opt/atom/resources/app/apm/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
gyp ERR! stack     at ClientRequest.g (events.js:180:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at Socket.socketOnData (http.js:1593:9)
gyp ERR! stack     at TCP.onread (net.js:528:27)
gyp ERR! System Linux 3.13.0-46-generic
gyp ERR! command "/opt/atom/resources/app/apm/bin/node" "/opt/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.21.0" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" "--proxy=http://wwwproxy:3128/"
gyp ERR! cwd /home/marcuslt/.atom
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

All proxy settings should be correct and it worked perfectly in earlier versions.

$ apm --version
apm  0.142.0
npm  2.5.1
node 0.10.35
python 2.7.6
git 1.9.1
@kevinsawicki
Copy link
Contributor

Could you try running apm config ls and verify the proxy settings there look correct?

@marcuslindfeldt
Copy link
Author

They seem fine to me and i haven't changed them between versions.

globalconfig = "/home/marcuslt/.atom/.apm/.apmrc"
user-agent = "npm/2.5.1 node/v0.10.35 linux x64"
userconfig = "/home/marcuslt/.atom/.apmrc"

; environment configs
http-proxy = "http://<proxy>:<port>"
https-proxy = "http://<proxy>:<port>"
proxy = "http://<proxy>:<port>"

@superbob
Copy link

Same here when trying to install Sublime-Style-Column-Selection :

gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | linux | x64
gyp http GET https://atom.io/download/atom-shell/v0.21.0/node-v0.21.0.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error 
gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error
gyp ERR! stack     at ClientRequest.onError (/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
gyp ERR! stack     at ClientRequest.g (events.js:180:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at Socket.socketOnData (http.js:1593:9)
gyp ERR! stack     at TCP.onread (net.js:528:27)
gyp ERR! System Linux 3.11.10-25-default
gyp ERR! command "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.21.0" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" "--proxy=http://127.0.0.1:3128/"
gyp ERR! cwd /home/f_mo/.atom
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
$ apm config ls
; cli configs
globalconfig = "/home/f_mo/.atom/.apm/.apmrc"
user-agent = "npm/2.5.1 node/v0.10.35 linux x64"
userconfig = "/home/f_mo/.atom/.apmrc"

; userconfig /home/f_mo/.atom/.apmrc
http-proxy = "http://127.0.0.1:3128"
https-proxy = "http://127.0.0.1:3128/"
strict-ssl = false

; globalconfig /home/f_mo/.atom/.apm/.apmrc
cache = "/home/f_mo/.atom/.apm"

; node bin location = /usr/share/atom/resources/app/apm/bin/node
; cwd = /home/f_mo/Téléchargements
; HOME = /home/f_mo/.atom/.node-gyp
; 'npm config ls -l' to show all defaults.
$ apm --version
apm  0.142.0
npm  2.5.1
node 0.10.35
python 2.7.6
git 1.8.4.5

@kevinsawicki
Copy link
Contributor

Hmm, I see the command was spawned with --proxy and it looks like it properly picked up the value from the config file.

Are either of you building Atom from source? I just added support for enabling verbose output from node-gyp when running apm install --verbose.

So if you build Atom yourselves and then ran apm install <package_name> --verbose using apm 0.151+ it should include confirmation that it is using the right proxy config.

@michaelkrnac
Copy link

Same problem here:

C:\Users\mkrnac>apm install minimap
Installing minimap to C:\Users\mkrnac\.atom\packages
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | win32 | ia32
gyp http GET https://atom.io/download/atom-shell/v0.21.0/node-v0.21.0.tar.gz
gyp WARN install got an error, rolling back install
gyp
C:\Users\mkrnac>apm --version
apm  0.149.0
npm  2.5.1
node 0.10.35
python 3.2.4
git 1.9.5.msysgit.1
visual studio 2010

Iam also behind a proxy

@h-no
Copy link

h-no commented Apr 7, 2015

For me this problem started today, Atom was updated to 0.189.0 (installed via webupd8 ppa) and when I tried to update my packages I got this error.

$ apm update
Package Updates Available (5)
├── autocomplete-plus 2.7.1 -> 2.8.0
├── color-picker 1.5.0 -> 1.6.0
├── linter-jscs 1.9.0 -> 1.10.0
├── linter-jshint 0.1.0 -> 0.1.1
└── minimap 4.7.1 -> 4.7.5

Would you like to install these updates? (yes) 

Installing autocomplete-plus@2.8.0 to /home/hannesna/.atom/packages 
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | linux | x64
gyp http GET https://atom.io/download/atom-shell/v0.22.0/node-v0.22.0.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error 
gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error
gyp ERR! stack     at ClientRequest.onError (/opt/atom/resources/app/apm/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
gyp ERR! stack     at ClientRequest.g (events.js:180:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at Socket.socketOnData (http.js:1593:9)
gyp ERR! stack     at TCP.onread (net.js:528:27)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "/opt/atom/resources/app/apm/bin/node" "/opt/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.22.0" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" "--proxy=http://wwwproxy:3128/"
gyp ERR! cwd /home/hannesna/.atom
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
$ apm config ls
; cli configs
globalconfig = "/home/hannesna/.atom/.apm/.apmrc"
user-agent = "npm/2.5.1 node/v0.10.35 linux x64"
userconfig = "/home/hannesna/.atom/.apmrc"

; userconfig /home/hannesna/.atom/.apmrc
https-proxy = "http://wwwproxy:3128/"
proxy = "http://wwwproxy:3128/"

; globalconfig /home/hannesna/.atom/.apm/.apmrc
cache = "/home/hannesna/.atom/.apm"

; node bin location = /opt/atom/resources/app/apm/bin/node
; cwd = /home/hannesna
; HOME = /home/hannesna/.atom/.node-gyp
; 'npm config ls -l' to show all defaults.
$ apm --version
apm  0.157.0
npm  2.5.1
node 0.10.35
python 2.7.6
git 1.9.1

@h-no
Copy link

h-no commented Apr 7, 2015

Installing a new package with --verbose
(apm 0.157.0)

$ apm install emmet --verbose
Installing emmet to /home/hannesna/.atom/packages REQUEST { method: 'GET',
  url: 'https://atom.io/api/packages/emmet',
  json: true,
  retries: 4,
  proxy: 'http://wwwproxy:3128/',
  strictSSL: true,
  headers: { 'User-Agent': 'npm/2.5.1 node/v0.10.35 linux x64' },
  uri: null,
  callback: [Function] }
REQUEST make request https://atom.io/api/packages/emmet
REQUEST onRequestResponse https://atom.io/api/packages/emmet 200 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:13 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  'content-type': 'application/json; charset=utf-8',
  etag: '"fb6f6e4a651dd173cfc8f11997520e78"',
  'cache-control': 'max-age=0, private, must-revalidate',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '2e70c448-9ddf-45a5-8cf2-ade29ebb6038',
  'x-runtime': '0.129718',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST finish init function https://atom.io/api/packages/emmet
REQUEST response end https://atom.io/api/packages/emmet 200 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:13 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  'content-type': 'application/json; charset=utf-8',
  etag: '"fb6f6e4a651dd173cfc8f11997520e78"',
  'cache-control': 'max-age=0, private, must-revalidate',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '2e70c448-9ddf-45a5-8cf2-ade29ebb6038',
  'x-runtime': '0.129718',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST end event https://atom.io/api/packages/emmet
REQUEST has body https://atom.io/api/packages/emmet 18497
REQUEST emitting complete https://atom.io/api/packages/emmet
REQUEST { method: 'GET',
  url: 'https://www.atom.io/api/packages/emmet/versions/2.3.6/tarball',
  proxy: 'http://wwwproxy:3128/',
  strictSSL: true,
  headers: { 'User-Agent': 'npm/2.5.1 node/v0.10.35 linux x64' },
  uri: null,
  callback: undefined }
REQUEST make request https://www.atom.io/api/packages/emmet/versions/2.3.6/tarball
REQUEST onRequestResponse https://www.atom.io/api/packages/emmet/versions/2.3.6/tarball 302 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:14 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  location: 'https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6',
  'content-type': 'text/html; charset=utf-8',
  'cache-control': 'no-cache',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '1a4c385a-f4ad-4e1c-bb90-31931dbe25fc',
  'x-runtime': '0.072120',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST redirect https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6
REQUEST redirect to https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6
REQUEST {}
REQUEST response end https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6 302 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:14 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  location: 'https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6',
  'content-type': 'text/html; charset=utf-8',
  'cache-control': 'no-cache',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '1a4c385a-f4ad-4e1c-bb90-31931dbe25fc',
  'x-runtime': '0.072120',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST make request https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6
REQUEST onRequestResponse https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6 200 { 'content-length': '77542',
  'access-control-allow-origin': 'https://render.githubusercontent.com',
  'content-security-policy': 'default-src \'none\'',
  'x-xss-protection': '1; mode=block',
  'x-frame-options': 'deny',
  'x-content-type-options': 'nosniff',
  'strict-transport-security': 'max-age=31536000',
  vary: 'Authorization,Accept-Encoding',
  etag: '"32913f368285e9a98cfcdc643096bd7df4a99c2e"',
  'content-type': 'application/x-gzip',
  'content-disposition': 'attachment; filename=emmetio-emmet-atom-v2.3.6-0-g32913f3.tar.gz',
  date: 'Tue, 07 Apr 2015 09:13:15 GMT' }
REQUEST finish init function https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6
REQUEST response end https://codeload.github.com/emmetio/emmet-atom/legacy.tar.gz/v2.3.6 200 { 'content-length': '77542',
  'access-control-allow-origin': 'https://render.githubusercontent.com',
  'content-security-policy': 'default-src \'none\'',
  'x-xss-protection': '1; mode=block',
  'x-frame-options': 'deny',
  'x-content-type-options': 'nosniff',
  'strict-transport-security': 'max-age=31536000',
  vary: 'Authorization,Accept-Encoding',
  etag: '"32913f368285e9a98cfcdc643096bd7df4a99c2e"',
  'content-type': 'application/x-gzip',
  'content-disposition': 'attachment; filename=emmetio-emmet-atom-v2.3.6-0-g32913f3.tar.gz',
  date: 'Tue, 07 Apr 2015 09:13:15 GMT' }
gyp info it worked if it ends with ok
gyp verb cli [ '/opt/atom/resources/app/apm/bin/node',
gyp verb cli   '/opt/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'install',
gyp verb cli   '--target=0.22.0',
gyp verb cli   '--dist-url=https://atom.io/download/atom-shell',
gyp verb cli   '--arch=x64',
gyp verb cli   '--ensure',
gyp verb cli   '--verbose',
gyp verb cli   '--proxy=http://wwwproxy:3128/' ]
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | linux | x64
gyp verb command install []
gyp verb install input version string "0.22.0"
gyp verb install installing version: 0.22.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 0.22.0
gyp verb ensuring nodedir is created /home/hannesna/.atom/.node-gyp/.node-gyp/0.22.0
gyp verb created nodedir /home/hannesna/.atom/.node-gyp/.node-gyp/0.22.0
gyp http GET https://atom.io/download/atom-shell/v0.22.0/node-v0.22.0.tar.gz
gyp verb download using proxy url: "http://wwwproxy:3128/"
REQUEST { proxy: 'http://wwwproxy:3128/',
  headers: { 'User-Agent': 'node-gyp v1.0.2 (node v0.10.35)' },
  uri: 'https://atom.io/download/atom-shell/v0.22.0/node-v0.22.0.tar.gz',
  callback: undefined }
REQUEST make request https://atom.io/download/atom-shell/v0.22.0/node-v0.22.0.tar.gz
REQUEST onRequestResponse https://atom.io/download/atom-shell/v0.22.0/node-v0.22.0.tar.gz 302 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:15 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  location: 'http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz',
  'content-type': 'text/html; charset=utf-8',
  'cache-control': 'no-cache',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '5c25953b-3419-4434-a6e2-86a90109fa89',
  'x-runtime': '0.015554',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST redirect http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz
REQUEST redirect to http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz
REQUEST {}
REQUEST response end http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz 302 { server: 'Cowboy',
  date: 'Tue, 07 Apr 2015 09:13:15 GMT',
  connection: 'keep-alive',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  location: 'http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz',
  'content-type': 'text/html; charset=utf-8',
  'cache-control': 'no-cache',
  'set-cookie': [ 'request_method=GET; path=/; secure' ],
  'x-request-id': '5c25953b-3419-4434-a6e2-86a90109fa89',
  'x-runtime': '0.015554',
  'transfer-encoding': 'chunked',
  via: '1.1 vegur' }
REQUEST make request http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v0.22.0/node-v0.22.0.tar.gz
gyp WARN install got an error, rolling back install
gyp verb command remove [ '0.22.0' ]
gyp verb remove using node-gyp dir: /home/hannesna/.atom/.node-gyp/.node-gyp
gyp verb remove removing target version: 0.22.0
gyp verb remove removing development files for version: 0.22.0
gyp ERR! install error 
gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error
gyp ERR! stack     at ClientRequest.onError (/opt/atom/resources/app/apm/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
gyp ERR! stack     at ClientRequest.g (events.js:180:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at Socket.socketOnData (http.js:1593:9)
gyp ERR! stack     at TCP.onread (net.js:528:27)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "/opt/atom/resources/app/apm/bin/node" "/opt/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.22.0" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" "--verbose" "--proxy=http://wwwproxy:3128/"
gyp ERR! cwd /home/hannesna/.atom
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

@noseglid

This comment has been minimized.

@wmira
Copy link

wmira commented Apr 7, 2015

Getting this as well. Im behind a proxy and have correct config. I can browse packages from atom but install throws the gyp error.

@wsouto
Copy link

wsouto commented Apr 7, 2015

Same here. Can browse and search packages, but not install. The error is the same of everybody.

Seems to me that this error is not because the proxy. Apm can search packages, which means that it's passing the proxy normally. Trying to install any packages and gyp gives a "Parse Error" as the cause of not being able to make the connection:

gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error

@ghost
Copy link

ghost commented Apr 9, 2015

Same here. Seems like gyp forgets proxy after redirection.
After manually running gyp with modified --disturl to get atom-shell 0.22.0 installed, it's working fine.

@noseglid
Copy link

@fujisaks Can you detail how you got this to work? I'm on severly outdated packages now because I can't upgrade.

@ghost
Copy link

ghost commented Apr 16, 2015

@noseglid OK. Here is what I typed:
(It's taken from my bash history, so don't forget to change the paths/proxy before you try)

$ HOME=~/.atom/.node-gyp/ "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.22.0" "--dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist" "--arch=x64" "--ensure" "--verbose" "--proxy=http://proxy:80"

It bypasses redirection and should make apm work until next atom-shell release.

@noseglid
Copy link

@fujisaks Thanks so much. I modified your command for linux and it worked. This is what I did (Ubuntu 14.04):

HOME=~/.atom/.node-gyp/ /opt/atom/resources/app/apm/bin/node /opt/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js "install" "--target=0.22.0" "--dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist" "--arch=x64" "--ensure" "--verbose" "--proxy=http://proxy:80"

@morberg
Copy link

morberg commented Apr 16, 2015

Thanks @fujisaks Works like a charm here! The only thing I needed to change was the proxy.

@Bjoernsen
Copy link

Thanks @fujisaks This fixes my issue #337.
BTW, I installed Atom using the .deb file (Ubuntu 14.04). I had to change the paths a bit. My command looks like

HOME=~/.atom/.node-gyp/ /usr/share/atom/resources/app/apm/bin/node /usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js "install" "--target=0.22.0" "--dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist" "--arch=x64" "--ensure" "--verbose" "--proxy=http://proxy:80"

@voelzmo
Copy link

voelzmo commented Apr 17, 2015

Thanks for the workaround guys, having the same problem here after coming back from vacation.

So this issue has been around for a month now, any way to give this some priority? I know, only enterprises suffer from this problem, but not being able to install a single atom package kind of sucks.

@tborychowski
Copy link

+1 (and referenced 2 other duplicates)

@radum
Copy link

radum commented Apr 20, 2015

I have been dealing with this issue for a week now and @fujisaks just saved me a total OS reinstall.

I can confirm this is working for Windows 7 x64 also. Had to change the paths of course but it works.

Here is the command I used using GIT BASH (won't work in CMD or Powershell without some work to update the paths but that should be easy)

Make sure you replace the {...} with your username and proxy settings.

HOME=/c/Users/{your_user}/.atom/.node-gyp/ /c/Users/{your_user}/AppData/Local/atom/app-0.192.0/resources/app/apm/bin/node /c/Users/{your_user}/AppData/Local/atom/app-0.192.0/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js "install" "--target=0.22.0" "--dist-url=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist" "--arch=x64" "--ensure" "--verbose" "--proxy=http://{your_proxy}:{proxy_port}"

@Fank
Copy link

Fank commented Apr 23, 2015

Since atom 0.194.0 im unable to update packages through apm update same with install.
Here the last lines $ apm update --verbose:

REQUEST onRequestResponse https://atom.io/api/packages/minimap 200 { server: 'Cowboy',
  connection: 'close',
  date: 'Thu, 23 Apr 2015 07:07:44 GMT',
  status: '200 OK',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  'content-type': 'application/json; charset=utf-8',
  etag: '"7bc5c431b9c8d46a684fed9c1194726d"',
  'cache-control': 'max-age=0, private, must-revalidate',
  'x-request-id': '7f08db86-f496-4471-8902-9149723684c9',
  'x-runtime': '0.310628',
  'x-rack-cache': 'miss',
  via: '1.1 vegur' }
REQUEST finish init function https://atom.io/api/packages/minimap
REQUEST response end https://atom.io/api/packages/linter 200 { server: 'Cowboy',
  connection: 'close',
  date: 'Thu, 23 Apr 2015 07:07:44 GMT',
  status: '200 OK',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  'content-type': 'application/json; charset=utf-8',
  etag: '"2bb48308bc26235b6ce825b8530ead54"',
  'cache-control': 'max-age=0, private, must-revalidate',
  'x-request-id': 'ea6b45bd-93f1-4fee-ba7a-22e19da43d96',
  'x-runtime': '0.207869',
  'x-rack-cache': 'miss',
  via: '1.1 vegur' }
REQUEST end event https://atom.io/api/packages/linter
REQUEST has body https://atom.io/api/packages/linter 63812
REQUEST emitting complete https://atom.io/api/packages/linter
REQUEST response end https://atom.io/api/packages/minimap 200 { server: 'Cowboy',
  connection: 'close',
  date: 'Thu, 23 Apr 2015 07:07:44 GMT',
  status: '200 OK',
  'strict-transport-security': 'max-age=631152000',
  'x-frame-options': 'DENY',
  'x-xss-protection': '1; mode=block',
  'x-content-type-options': 'nosniff',
  'content-security-policy': 'default-src \'self\'; connect-src \'self\'; font-src \'self\'; frame-src \'self\'; img-src https://* \'self\' data:; media-src \'none\'; object-src \'self\'; script-src \'self\' \'unsafe-inline\' https://ssl.google-analytics.com https://www.google-analytics.com; style-src \'self\' \'unsafe-inline\';',
  'content-type': 'application/json; charset=utf-8',
  etag: '"7bc5c431b9c8d46a684fed9c1194726d"',
  'cache-control': 'max-age=0, private, must-revalidate',
  'x-request-id': '7f08db86-f496-4471-8902-9149723684c9',
  'x-runtime': '0.310628',
  'x-rack-cache': 'miss',
  via: '1.1 vegur' }
REQUEST end event https://atom.io/api/packages/minimap
REQUEST has body https://atom.io/api/packages/minimap 80862
REQUEST emitting complete https://atom.io/api/packages/minimap
Request for package information failed: tunneling socket could not be established, cause=Parse Error

@50Wliu 50Wliu added the bug label Apr 23, 2015
@TedThiCo
Copy link

Seems that node-gyp isn't following the 302 Redirect sent by atom.io.

@fujisaks Thanks for pointing to the problem!

I've been able to workaround the issue by setting the ATOM_NODE_URL env variable to the new url (after redirect ). This should also be working after you update Atom. However, remove the entry when the bug gets fixed!

Windows temporary:
set ATOM_NODE_URL=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist

Windows permanently:
setx ATOM_NODE_URL http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist /M

Linux
export ATOM_NODE_URL=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist

@okoetter
Copy link

Thanks TedThiCo, this workaround worked for me (Win7x64).

@nixar
Copy link

nixar commented Apr 29, 2015

It looks like the root cause of this problem has not been pointed out. Here's what going on:

avril 29 17:12:24 <redacted> cntlm[10008]: 127.0.0.1 CONNECT atom.io:443
avril 29 17:12:27 <redacted> cntlm[10008]: 127.0.0.1 CONNECT gh-contractor-zcbenz.s3.amazonaws.com:80

It looks like that when supplied an https URL that returns a redirect to an http address, apm uses a CONNECT method on the proxy instead of issuing a GET. As expected, most proxies will reject this.

@gaving
Copy link

gaving commented May 1, 2015

❤️ @TedThiCo, that did the trick!

@RinatMullayanov
Copy link

@TedThiCo respect, It solved the problem.

@neclepsio
Copy link

I have the same problem with the just-downloaded stable package under Windows 7 x64. NPM works, APM doesn't with the very same configuration. The output is:

[...]
REQUEST { url: 'https://atom.io/api/packages/language-qml',
  json: true,
  retries: 4,
  proxy: 'http://USER:PASSWORD@PROXY:PORT',
  strictSSL: false,
  headers: { 'User-Agent': 'npm/3.10.5 node/v4.4.5 win32 x64' },
  callback: [Function],
  method: 'GET' }
REQUEST make request https://atom.io/api/packages/language-qml failed
Request for package information failed: socket hang up (5 attempts) (ECONNRESET)

If I set ATOM_API_URL=http://atom.io/api it fails after a redirect to the https server version.

I can download the requested url with Chrome.

In my case set ATOM_NODE_URL=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist does not work either.

@MateuszStepniak
Copy link

As for my case, even the workaround I used stopped working. How about reopening the issue?

@wattachai
Copy link

I would like to confirm that the workaround (adding proxy info to .apmrc) doesn't work anymore since ATOM has been updated to 1.15. I believe reopening the issue is good idea.

@darahak
Copy link

darahak commented Mar 23, 2017

It also stopped working for me, but I can't remember if it was before or after I upgraded to Atom 1.15.

My setup could be different, but FWIW I had to remove proxy info in my .apmrc config file, but also the HTTP_PROXY environment variable, since it's apparently used as a fallback.

@nxtzero
Copy link

nxtzero commented Mar 24, 2017

I have a local proxy (Cntlm) that redirects to my corporate proxy to solve authentication problems.

And in my .apmrc config file:

strict-ssl=false
proxy=http://127.0.0.1:3128

@wattachai
Copy link

@nxtzero Did you set Cntlm on Windows? I tried it before on 0.93.2 but the it freezes most of the time. I couldn't update/install any Atom packages. (sad)

@nxtzero
Copy link

nxtzero commented Mar 27, 2017

I have version Cntlm 0.92.3 on Windows 7 (64 bits) with no problems. Just changed proxy, username, domain and password... Very rarely, like once a month, it crashes and I have to restart the service.

I believe it is still the last version on Cntlm Authentication Proxy

@neclepsio
Copy link

cntlm does not fix for me. I think the problem is the atom registry redirects to https even if asking for http.

@TomFoyster
Copy link

Is it possible to set the atm registry like you can with npm?

@nxtzero
Copy link

nxtzero commented Mar 27, 2017

@neclepsio Have you tried to set/unset Atom check on Settings > Core > Use Proxy Settings When Calling APM ?
And do you have strict-ssl=false and proxy=http://... on your user's directory .atom/.apm/.apmrc ?

@neclepsio
Copy link

@nxtzero Yes. I always get "socket hang up".

@javigf
Copy link

javigf commented Apr 6, 2017

yep, same error behind a corporate proxy.

@ethernal
Copy link

I can confirm the same error on 1.15 not sure, but I believe it worked with cntlm before that version.

@wattachai
Copy link

1.16 has just been released. I could confirm that the workaround of setting proxy in .apmrc and environment variable works on Windows 10. Note that, "use proxy setting when calling APM" is disabled. It seems there is a regression in 1.15 release.

@ethernal
Copy link

would you please explain what you mean by "use proxy setting when calling APM" @wattachai? If use of apmrc can be controlled during runtime that would fix the issue for portable version. I'll be testing 1.16 momentarly.

@ethernal
Copy link

The portable installation (from ZIP file) still does not respect ENV variables on Windows and requires a use of .apmrc file inside .atom folder (and that file is not present there by default).

@wattachai
Copy link

@ethernal "use proxy setting when calling APM" is a setting you can find on setting page of atom itself.

screen shot 2017-04-13 at 20 12 45

Let me describe what I did.
I disabled the above setting and made change to .apmrc with the following command in cmd:

apm config set http-proxy http://<proxy>:<port>  
apm config set https-proxy http://<proxy>:<port>
apm config set strict-ssl false
apm config set registry http://registry.npmjs.org

After that, package update worked but I couldn't see any package detail, no. of download or package thumbnail.

Not giving up, I added a system environment variable: HTTP_PROXY pointing it to the same proxy in .apmr and restarted machine. Now package page of atom works like a charm. Yeah!

I will try to enable "use proxy setting when calling APM" without those workaround later with a hope that it would just work. (finger crossed)

@az-z
Copy link

az-z commented Apr 27, 2017

well this is good. but why apm can not supporting SSL checks? i have CA for the proxy and curl is working just fine when i point it to the right directory...
I don't think this ticket is resolved. Please reopen.

@chadflorian
Copy link

+1 for this issue still existing... 407 error no matter that I try from this thread.

@jekriske-lilly
Copy link

407 means unauthorized. You need to provide your proxy with credentials.
Usually this is in the form of http://user:pass@yourproxyaddress:port

@chadflorian
Copy link

I've tried that as well as every other iteration in this thread.

@az-z
Copy link

az-z commented Jul 27, 2017 via email

@chadflorian
Copy link

cntlm workaround works... but man.. what a PITA

@az-z
Copy link

az-z commented Jul 27, 2017 via email

@Rexeh
Copy link

Rexeh commented Aug 9, 2017

One solution that has worked for me. Install Fiddler on your machine, have it open and ensure Rules > Automatically Authenticate is set.

Set your https-proxy to 127.0.0.1:8888

All traffic will then route via Fiddler and handle all NTLM negotiations.

@yselivonchyk
Copy link

The comment by gabo2000git (Sep 6, 2016) helped

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests