Skip to content

Instantly share code, notes, and snippets.

@witmin
Last active November 15, 2021 09:26
Show Gist options
  • Save witmin/5ed4c1b1f12531ef3d5ef6c79af95808 to your computer and use it in GitHub Desktop.
Save witmin/5ed4c1b1f12531ef3d5ef6c79af95808 to your computer and use it in GitHub Desktop.
Check and upgrade node dependencies version

To update to a new major version all the packages, install the npm-check-updates package globally:

npm install -g npm-check-updates

then run it:

ncu -u

this will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version.

You are now ready to run the update:

npm update

If you just downloaded the project without the node_modules dependencies and you want to install the shiny new versions first, just run

npm install

For GatsbyJS site, if you use npm 7 you’ll want to use the --legacy-peer-deps option when following the instructions in this guide. For example, the above command would be:

npm install gatsby@latest --legacy-peer-deps

Reference rsources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment