What command can I run to change all the versions in my package.json
to be the exact installed versions mentioned in the yarn.lock
?
My package.json
has unlocked versions like "^3". It has lines like:
"dependencies": {
"next": "15.2.3",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^3",
"eslint": "9.17.0",
"storybook": "^8.6.8",
"tailwindcss": "^4",
"typescript": "^5"
},
I thought I'd be able to run something like yarn upgrade --exact
or yarn install --exact
, but those were wrong.
I didn't see the answer at How can I update each dependency in package.json to the latest version?