APM does not work and is trying to download iojs


I am using a newly installed Atom on Mac OS X, but I cannot install any package to it, either through Atom settings or apm command.

By adding --verbose, I can see that apm is always trying to download iojs-v1.3.13.tar.gz, when I have Node.js v7.7.4 global and Node.js v4.4.5 in apm.

Here are some logs:

# apm -v
apm  1.15.3
npm  3.10.5
node 4.4.5 x64
python 2.7.10
git 2.10.1
# apm install --check
Checking for native build tools ✗

gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@4.4.5 | darwin | x64
gyp http GET https://atom.io/download/electron/v1.3.13/iojs-v1.3.13.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error
gyp ERR! stack Error: connect ETIMEDOUT
gyp ERR! stack     at Object.exports._errnoException (util.js:870:11)
gyp ERR! stack     at exports._exceptionWithHostPort (util.js:893:20)
gyp ERR! stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/node-gyp/bin/node-gyp.js" "install" "--runtime=electron" "--target=1.3.13" "--dist-url=https://atom.io/download/electron" "--arch=x64" "--ensure"
gyp ERR! cwd /Users/gerald/.atom
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Is there anyway to fix this? Thanks in advance.


Finally found the answer by reading source code of APM.

Just set ATOM_ELECTRON_URL to a reachable mirror, e.g. export ATOM_ELECTRON_URL=https://npm.taobao.org/mirrors/atom-shell.


set ATOM_ELECTRON_URL, not APM_ELECTRON_URL. Please fix it, thanks


Thanks, just fixed it.


I am lucky to see this answer! But, I am new one ,can you tell me more details about what should I do? Thank you first.