npm install on a fresh project installs the latest package versions and satisfies the semantic versioning ranges defined in the project’s
package.json. After the initial install, re-running
npm install will not update existing packages since
npm will have already found satisfying versions of packages installed on the file system.
- Lists the packages that the project depends on.
- Specifies versions of a package that the project can use with semantic versioning rules.
The procedure used to update the dependencies in the
package.json file to the latest minor version is outlined here. However, this method leaves the
A user may want to update the dependencies specified in
package.json to the latest major version if they are sure that the project will still work without breaking anything.
Doing so will update the version numbers specified in the front of each package, hence updating the project’s
The correct way to do so is:
npm install -g npm-check-updates ncu -u npm install
Now, all of the package versions in
package.json will be the most recent ones.