程序员人生 网站导航

如何解决atom无法安装package的问题(gyp WARN install got an error, rolling back install)

栏目:综合技术时间:2016-06-24 13:54:47

在开源editor领域,你不能不注意到atom的存在:当sublime text 3开始收费,eclipse变得愈来愈臃肿而慢,而且UI及其难看,atom将是1个很好的选择。但当我第1次使用atom的时候遇到了下面的这个问题:

C:\Users\pt100314\.atom>apm install editor-stats --unsafe Installing editor-stats to C:\Users\pt100314\.atom\packages gyp info it worked if it ends with ok gyp info using node-gyp@2.0.2 gyp info using node@0.10.40 | win32 | ia32 gyp http GET https://atom.io/download/atom-shell/v0.34.5/node-v0.34.5.tar.gz gyp WARN install got an error, rolling back install gyp

从这个打印上看,应当是gyp没法完成http GET(没法完成atom.io的302重定向)
这里有1个临时的解决方案,就是把ATOM_NODE_URL环境变量设为重定向以后的Url :

Windows temporary:

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

Windows permanently (execute “cmd” with “Run as Administrator”):

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
------分隔线----------------------------
------分隔线----------------------------

最新技术推荐