1.nvm修改下载源:在ubuntu中找到安装nvm的路径,找到'.nvm/nvm.sh'文件,用sudo vim .nvm/nvm.sh打开,
然后用'/'搜索‘NVM_NODEJS_ORG_MIRROR’,enter定位到该位置,修改其中的网址为‘https://npm.taobao.org/mirrors/node/’即可
2.npm修改下载源:在ubuntu中执行指令:
查看下载源指令:
npm config set registry
*淘宝源
npm config set registry https://registry.npm.taobao.org/
*官方源(默认)
npm config set registry https://registry.npmjs.org/
临时使用淘宝源:
npm --registry=https://registry.npm.taobao.org install [应用]
也可以使用cnpm来安装:
1.使用阿里定制的 cnpm 命令行工具代替默认的 npm,输入下面代码进行安装:
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
2.检测cnpm版本,如果安装成功可以看到cnpm的基本信息。
cnpm -v
3.以后安装插件只需要使用cnpm intall
即可