使用 npm 安装 node.js 包时会很慢,使用国内镜像可以提高速度。
方式一
npm install --registry=https://registry.npm.taobao.org
方式二
export npm_config_registry=https://registry.npm.taobao.org npm install
方式三
npm config set registry=https://registry.npm.taobao.org npm install使用
yarnyarn config set registry https://registry.npm.taobao.org yarn install
最后再推荐一下 淘宝 NPM 镜像 ,不但有 npm 的镜像,还有 node.js镜像 ,以后安装 node.js 可以更方便了。