text 使用npm和yarn更新包

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 使用npm和yarn更新包相关的知识,希望对你有一定的参考价值。

Below are a set of commands to list globally installed packages and a set of commands to updated them.

npm
To update npm packages we have npm-check. First you will have to install it globally

npm i npm-check -g
Then to list packages that need to be updated

npm-check -gu
We pass -g flag to do a global search, then u flag to update. This will give us an interactive menu where you can move up/down the list
of packages, then press space bar to select them, finally press Enter key to update the selected packages.

Now to list all of your packages

npm list -g --depth=0
Again we pass the -g flag to do a global search and — depth=0 to give us a clean list. If you don’t then it will give us a very verbose
list, listing all of the dependencies for each package as well.

Yarn
With yarn we don’t have to install another package, just run

yarn global upgrade-interactive
We pass the global flag to do a global search. And as with npm, you can move up/down the list of packages, then press space bar to 
select them, finally press Enter key to update the selected packages.

To list global packages

yarn global list

以上是关于text 使用npm和yarn更新包的主要内容,如果未能解决你的问题,请参考以下文章

npm和yarn使用

[yarn]yarn和npm的对比

(node.js) 交替安装 NPM 和 YARN

yarn使用 以及和npm对比

包管理工具Yarn的使用和命令总结

修改Yarn和npm的全局安装和缓存位置