NPM和YARN指令区别和设置淘宝镜像

305 阅读1分钟

NPM

  • 查询当前镜像
npm get registry 
  • 设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org/
  • 设置为官方镜像
npm config set registry https://registry.npmjs.org/

YARN

  • 查询当前镜像
yarn config get registry
  • 设置为淘宝镜像
yarn config set registry https://registry.npm.taobao.org/
  • 设置为官方镜像
yarn config set registry https://registry.yarnpkg.com

\

npmyarn
npm installyarn
npm install react --saveyarn add react
npm uninstall react --saveyarn remove react
npm install react --save-devyarn add react --dev
npm update --saveyarn upgrade