Yarn - How do I update each dependency in package.json to the latest version?

The one that worked for me is from a comment by @Andrew Zolotarev, which uses

npx yarn-upgrade-all

You can upgrade a single package to the latest major version with this:

yarn upgrade <package-name> --latest

You can try this npm package yarn-upgrade-all. This package will remove every package in package.json and add it again which will update it to latest version.

installation:

npm install -g yarn-upgrade-all

usage: in your project directory run:

yarn yarn-upgrade-all

yarn upgrade-interactive --latest

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.