前言
心血来潮,突然想换一个代码编辑器,在百度上搜来搜去看中了Atom。不过这家伙默认是英文界面,想切换成中文还要再安装一个汉化插件,而问题也由此而来。。。
问题表现
安装插件时提示如下错误:
Installing “simplified-chinese-menu@5.3.5” failed.Hide output… gyp info it worked if it ends with ok gyp info using node-gyp@3.4.0 gyp info using node@6.9.5 | win32 | x64 gyp http GET https://atom.io/download/electron/v1.6.15/iojs-v1.6.15.tar.gz gyp WARN install got an error, rolling back install gyp ERR! install error gyp ERR! stack Error: connect ECONNREFUSED 52.216.80.64:443 gyp ERR! stack at Object.exports._errnoException (util.js:1022:11) gyp ERR! stack at exports._exceptionWithHostPort (util.js:1045:20) gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "C:\\Users\\huaidan\\AppData\\Local\\atom\\app-1.23.3\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\huaidan\\AppData\\Local\\atom\\app-1.23.3\\resources\\app\\apm\\node_modules\\node-gyp\\bin\\node-gyp.js" "install" "--runtime=electron" "--target=1.6.15" "--dist-url=https://atom.io/download/electron" "--arch=x64" "--ensure" gyp ERR! cwd C:\Users\huaidan\.atom gyp ERR! node -v v6.9.5 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok Compiler tools not found Packages that depend on modules that contain C/C++ code will fail to install. Read here for instructions on installing Python and Visual Studio. Run apm install --check after installing to test compiling a native module.
问题原因
这个问题其实是伟大的社会主义和谐墙导致的,当然,我不是批评和谐墙,也不是说和谐墙不好,只是和谐墙有时候可能会误伤一些正规站点,让人很无奈,而且还不许搭梯子。。。
解决方法:
打开CMD命令提示符(Linux下则打开shell,执行的命令都是相同的)。
C:\>apm config set registry https://registry.npm.taobao.org //切换npm源为国内源 C:\>apm install //安装环境软件 Installing modules done //提示安装成功
此时再次返回Atom中安装插件即可成功。