淘宝源加速
#方法一(淘宝源加速)
npm config set unsafe-perm=true
npm config set registry https://registry.npmmirror.com
#github加速
git config --global url."https://gitclone.com/".insteadOf "https://github.com/"
#查看
npm config list
#方法二 cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com
cnpm install
cnpm run build:jobpi
常用命令
检查镜像源
npm config get registry
npm config get registry
#官方镜像
npm config set registry https://registry.npmjs.org/
#加速镜像
npm config set registry https://registry.npmmirror.com
#腾讯云
npm config set registry http://mirrors.cloud.tencent.com/npm/
#淘宝镜像
npm config set registry http://registry.npm.taobao.org
#安装nrm小工具
npm i nrm -g
查看所有可用的镜像源
nrm ls
将下包的镜像源切换为taobao镜像
nrm use taobao
npm config
设置loglevel=http可以查看下载进度
npm config set loglevel http
npm install node-sass --sass-binary-site=https://npm.taobao.org/mirrors/node-sass
单独加速安装node-sass
#node-sass加速
SASS_BINARY_SITE=https://npmmirror.com/mirrors/node-sass/ npm install node-sass
或者
npm install node-sass --sass-binary-site=https://registry.npmmirror.com/node-sass
#canvas加速
npm install canvas --canvas_binary_host_mirror=https://npm.taobao.org/mirrors/node-canvas-prebuilt/
npm install canvas --canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
#sqlite3加速
npm install sqlite3 --node_sqlite3_binary_host_mirror=http://npm.taobao.org/mirrors
#指定版本
npm install electron@13.6.9 --save-dev --registry=https://registry.npmmirror.com
npm install electron --registry=https://registry.npmmirror.com
#指定版本
npm install electron@13.6.9 --save-dev --registry=https://registry.npmmirror.com
https://npm.taobao.org/mirrors/electron/