众所周知,dddd,npm和yarn的官方源速度似乎有点慢,所以需要更换淘宝源
npm
使用cnpm
如果不想修改官方源的话,可以使用阿里定制的cnpm命令行工具代替默认的npm
安装:
npm install -g cnpm --registry=https://registry.npm.taobao.org验证:
cnpm -v在使用上和npm功能一致,把npm改成cnpm即可
修改源
单次使用
在参数后面跟上--registry=https://registry.npm.taobao.org即可,例如:
npm install --registry=https://registry.npm.taobao.org永久修改
修改为淘宝源:
npm config set registry https://registry.npm.taobao.org验证修改:
npm config get registry修改为官方源:
npm config set registry https://registry.npmjs.org/yarn
跟npm的方法大同小异
单次使用
在参数后面跟上--registry https://registry.npm.taobao.org/即可,例如:
yarn save package_name --registry https://registry.npm.taobao.org/永久修改
修改为淘宝源:
yarn config set registry https://registry.npm.taobao.org/验证修改:
yarn config get registry修改为官方源:
yarn config set registry https://registry.yarnpkg.com