flover
flover

Reputation: 37

How to do "yarn upgrade" in yarn 3

I've recently upgraded my react-native project to RN v0.74, which now comes with yarn 3 as default (still using node_modules folder). Before i was using yarn 1.

So now i wanted to upgrade my packages to the latest minor/patch version (based on what is defined in the package.json). With yarn 1 i just ran yarn upgrade, but this command no longer exists with later versions of yarn and the other alternative commands i've found seem to not work.

The recommended alternative for yarn upgrade seems to be yarn up, but that command does nothing when i run it. When i run yarn up "**" (or yarn up myPackage) it would upgrade every package to the latest version, ignoring the range defined in the package.json. E.g. when i have myPackage: "^1.1.0" defined, then i want it to install the latest minor version (e.g. 1.2.0), but not 2.0.0

I've only found that when i remove the yarn.lock and then run yarn install, it would actually install the correct package versions, though there should probably be a better way that wouldnt require deleting the yarn.lock first.

So how do you upgrade packages with yarn 3 correctly?

Upvotes: 0

Views: 296

Answers (0)

Related Questions