前言

国内安装国外源,容易失败,如

1
node-sass
。因为 GitHub Releases 里的文件都托管在 s3.amazonaws.com上面,而这个网址在国内总是网络不稳定,所以我们需要通过第三方服务器下载这个文件。

方案

方法一:使用淘宝源 npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ npm config set phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/ npm config set electron_mirror=https://npm.taobao.org/mirrors/electron/ npm config set registry=https://registry.npm.taobao.org

这样使用 npm install 安装 node-sass、electron 和 phantomjs 时都能自动从淘宝源上下载。

方法二:安装cnpm »> 也是淘宝源的做法 npm install -g cnpm cnpm install
这样也可以成功安装node-saa