npm 与 yarn 常用命令对比
检查依赖是否可更新
npm outdated [-g]yarn [global] outdated
更新依赖包到最新版本
npm update [-g]yarn [global] upgrade
锁定依赖包版本号(生成 npm-shrinkwrap.json 文件)
npm shrinkwrapyarn generate-lock-entry&&yarn install
固定依赖包版本号(修改 package.json 文件)
npm config set save-prefix="~"npm config set save-exact true
线上环境更新依赖包(仅安装 dependencies 里面的包)
npm install --productionyarn install --production
安装 package.json 中所有依赖
npm installyarn install
安装生产依赖(指定版本)
npm install --save [email protected]yarn add [email protected]
安装开发依赖(指定版本)
npm install --save-dev [email protected]yarn add [email protected] --dev
安装全局依赖(指定版本)
npm install --global [email protected]yarn global add [email protected]
卸载生产依赖
npm uninstall --save lodashyarn remove lodash
卸载开发依赖
npm uninstall --save-dev lodash
-yarn remove lodash --dev
更新生产依赖
npm update --saveyarn upgrade
升级全局依赖到最新版本
npm update lodash -gyarn global upgrade webpack
查看全局依赖包
npm ls -g
點擊查看更多內容
2人點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦