npm和yarn命令对比

初始化项目:
npm init
yarn init

安装:
npm install(i)
yarn

卸载:
npm uninstall(un)
yarn remove

全局安装:
npm install xxx –-global(-g)
yarn global add xxx

安装包:
npm install xxx –save(-S)
yarn add xxx

开发模式安装包:
npm install xxx –save-dev(-D)
yarn add xxx –dev(-D)

更新:
npm update –save
yarn upgrade

全局更新:
npm update –global
yarn global upgrade

清除缓存:
npm cache clean
yarn cache clean

重新下载所有包:
npm rebuild
yarn install –force

安装指定版本的包:
npm install [package]@[version]
yarn add [package]@[version]

发布:
npm publish
yarn publish

登录:
npm login
yarn login

登出:
npm logout
yarn logout

运行某个命令:
npm run/test
yarn run/test

你可能感兴趣的:(npm和yarn命令对比)