Yarn - 如何将 package.json 中的每个依赖项更新到最新版本? [英] Yarn - How do I update each dependency in package.json to the latest version?
问题描述
我有一个已弃用依赖项的 React 应用程序.为了使其工作,我必须将依赖项更新为较新(但稳定)的版本.
I have a react app with deprecated dependencies. To make it work, I have to update the dependencies to their newer (but stable) versions.
根据 这个stakoverflow 线程,将 package.json 中的依赖项更新到最新版本,npm-check-updates 是 npm 的最佳选择.但是,我使用纱线进行包管理.纱线中是否有相当于 npm-check-updates 的东西.因此,我使用单个包管理器来管理我的依赖项.
As per this stakoverflow thread, to update dependencies in package.json to latest versions, npm-check-updates is the Best Option for npm. However, I'm using yarn for package management. Is there an equivalent of npm-check-updates in yarn. So that, I use a single package manager to manage my dependencies.
推荐答案
yarn upgrade-interactive --latest
但是你必须有一个 yarn.lock
文件才能这样做.如果你使用 npm
,你必须先删除 package-lock.json
.然后运行 yarn
来创建结构.之后,您可以执行upgrade-interactive
.没有它,yarn
显示升级,但 package.json
没有变化和影响.
But you have to have a yarn.lock
file before do it. If you are using npm
, you must delete package-lock.json
first. Then run yarn
to create structure. After that you can do upgrade-interactive
. Without that, yarn
shows upgrade, but no changes and effects in package.json
.
这篇关于Yarn - 如何将 package.json 中的每个依赖项更新到最新版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!