在国外,受网速影响比较大
https://registry.npmjs.org/
1.配置 npm 为淘宝镜像
npm config set registry https://registry.npm.taobao.org
2.安装 cnpm 为淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
如果还想使用原来的国外的镜像
https://registry.npmjs.org/
-----------------------------------------------------------------------------------
yarn
安装 yarn
npm i yarn -g / cpnm i yarn -g
查看版本
yarn -v 如果能打印出版本号,说明安装成功
下载模块包
npm i xxx / cnpm i xxx / yarn add xxx