Installation node-sass time will always be various unsuccessful, and today I reflected for a moment and finally know how to solve.
First thing to know is that the installation node-sass
when node scripts/install
downloaded from a stage github.com .node
file, most of the reasons are derived from the installation is unsuccessful here, because GitHub Releases where the files are hosted on s3.amazonaws.com
top, and this website in the country always network instability , so we need to download this file by a third-party server.
Use a mirror Taobao
macOS system directly run the following command:
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass
We generally prefer to be able to cross-platform, and directly npm install
install all the dependencies, so my approach is to add in a project .npmrc
file:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
registry=https://registry.npm.taobao.org
Use this npm install
installation node-sass
, electron
and phantomjs
when can automatically download the source from Taobao, but in the use of npm publish
time should registry
this line to comment out, otherwise it will be released to go up Taobao source.
If a window system, then do not worry about the split step is like
cmd window executed first
set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
Then npm install node-sass will find almost be installed in seconds
Before each installation requires then set about