I copied package.json
from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don\'t mind
If you use yarn, the following command updates all packages to their latest version:
yarn upgrade --latest
From their docs:
The
upgrade --latest
command upgrades packages the same as the upgrade command, but ignores the version range specified in package.json. Instead, the version specified by the latest tag will be used (potentially upgrading the packages across major versions).
*
as the version for the latest releases, including unstablelatest
as version definition for the latest stable versionHere is an example:
"dependencies": {
"express": "latest" // using the latest STABLE version
, "node-gyp": "latest"
, "jade": "latest"
, "mongoose": "*" // using the newest version, may involve the unstable releases
, "cookie-parser": "latest"
, "express-session": "latest"
, "body-parser": "latest"
, "nodemailer":"latest"
, "validator": "latest"
, "bcrypt": "latest"
, "formidable": "latest"
, "path": "latest"
, "fs-extra": "latest"
, "moment": "latest"
, "express-device": "latest"
},
The only caveat I have found with the best answer above is that it updates the modules to the latest version. This means it could update to an unstable alpha build.
I would use that npm-check-updates utility. My group used this tool and it worked effectively by installing the stable updates.
As Etienne stated above: install and run with this:
$ npm install -g npm-check-updates
$ npm-check-updates -u
$ npm install
The above commands are unsafe because you might break your module when switching versions. Instead I recommend the following
npm shrinkwrap
command.npm install -g next-update // from your package next-update
If you happen to be using Visual Studio Code as your IDE, this is a fun little extension to make updating package.json
a one click process.
Should get you the latest wanted versions compatible for your app. But not the latest versions.