Yarn 和 NPM 区别
文章目录

Command Comparison

作用 npm Yarn
安装 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 uninstall [–save/–save-dev] yarn remove xx
清除缓存 npm cache clean yarn cache clean
重装 rm -rf node_modules && npm install yarn upgrade

审核更新本地包 (此方法不更新 package.json)

https://classic.yarnpkg.com/en/docs/cli/audit/

1
2
3
4
5
yarn audit

或者

npm audit

可以开始并更新本地包

1
npm audit fix

更新本地包并更新 package.json

1
2
# 需要手动选择升级的依赖包,按空格键选择,a 键切换所有,i 键反选选择
yarn upgrade-interactive --latest --save

Reference

https://blog.csdn.net/qq_40963664/article/details/82768227