snippets/old_snippets/update-npm-packages.en.md

958 B

title seo_description date draft snippet_types
update npm packages to latest versions How to update the node modules of a project to their latest version 2022-06-15T09:28:28+02:00 false
npm
js
node

I was doing some housekeeping on a Node.JS project today. Wanted to update all the dependencies to their latest versions. At first I tried npm update but come to find out that is ment more for upgrading single packages and not major versions. In the end after some googling I found npm-check-updates.

To upgrade the dependencies of a project without installing anything else I ran:

$ npx npm-check-updates -u

It updated the package.json so it must be followed up by a:

$ npm i

Which will install the new packages and update the package-lock.json.

source