node-sass的安装
在nodejs环境运行的项目中需要使用node-sass依赖时,会经常出现下载失败的现象。往往会显示从github.com上下载.node文件,因为从国内连接外网的原因,下载失败的几率非常高。
1、npm指令下载:
npm i node-sass
下载速度很慢,失败的可能性很高。
2、cnpm指令下载:
cnpm install node-sass
直接使用淘宝镜像指令下载,因为使用淘宝镜像,下载成功率较高。
3、第一种方式失败时,可以先换一个镜像源地址再下载:
换镜像源地址:set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/
换镜像源地址之后下载:npm install node-sass