npm install --save node-sass --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
or
先改變本機的sass下載的數據源
npm config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
然后 安裝
npm i node-sass -S
npm更換成淘寶的源
npm config set registry https://registry.npm.taobao.org
– 配置后可通過下面方式來驗證是否成功
npm config get registry
發布npm包的時候切換為原始url:npm config set registry https://registry.npmjs.org
也可安裝nrm【管理npm的數據源的工具】:npm i -g nrm
顯示數據源list: nrm ls
npm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ * taobao - http://registry.npm.taobao.org/ edunpm - http://registry.enpmjs.org/ eu ----- http://registry.npmjs.eu/ au ----- http://registry.npmjs.org.au/ sl ----- http://npm.strongloop.com/ nj ----- https://registry.nodejitsu.com/ pt ----- http://registry.npmjs.pt/
切換npm數據源:nrm use taobao或者nrm use eu
----------------------- 使用yarn ------------------------------------------
yarn config get registry # -> https://registry.yarnpkg.com
可以改成 taobao 的源:
yarn config set registry https://registry.npm.taobao.org # -> yarn config v0.24.5 # -> success Set "registry" to "https://registry.npm.taobao.org". # -> Done in 0.03s.
