activate-power-mode的超炫編輯效果打動了我,花時間安裝了atom,之后在package,install里面找到了這個插件,但是安裝失敗,如下圖所示:
gyp info it worked if it ends with ok gyp info using node-gyp@2.0.2 gyp info using node@0.10.40 | darwin | x64 gyp http GET https://atom.io/download/atom-shell/v0.34.3/node-v0.34.3.tar.gz gyp WARN install got an error, rolling back install gyp ERR! install error gyp ERR! stack Error: socket hang up gyp ERR! stack at createHangUpError (http.js:1473:15) gyp ERR! stack at Socket.socketOnEnd (http.js:1569:23) gyp ERR! stack at Socket.g (events.js:180:16) gyp ERR! stack at Socket.emit (events.js:117:20) gyp ERR! stack at _stream_readable.js:944:16 gyp ERR! stack at process._tickCallback (node.js:448:13) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/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.34.3" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" gyp ERR! cwd /Users/luozhifan/.atom gyp ERR! node -v v0.10.40 gyp ERR! node-gyp -v v2.0.2 gyp ERR! not ok
用了公司的vpn,網絡肯定沒問題,看來是atom的下載模塊有問題,於是做了如下操作,問題順利解決:
1, 用chrome下載該文件,同時把同目錄下的SHASUMS256.txt也下載下來,放置在同一目錄里面,目錄起名v0.34.3,
https://atom.io/download/atom-shell/v0.34.3/node-v0.34.3.tar.gz
https://atom.io/download/atom-shell/v0.34.3/SHASUMS256.txt
2, 上一級目錄,執行命令 sudo Python -m SimpleHTTPServer 80, 啟動web server,替換node的升級下載服務器
3,將出錯信息中的命令行復制出來,修改dist-url參數后,在控制台中執行,完成node升級。
"/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.34.3" "--dist-url=http://localhost" "--arch=x64" "--ensure"
4,修改
/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/node_modules/node-gyp/lib/install.js
在go()函數入口168行添加:
//todo: lzf skip node update
cb()
return
跳過node升級過程,改動完成。
