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
npm outdated
npm update
git commit package-lock.json
npm install -g npm-check-updates
npm-check-updates
npm shrinkwrap
git commit package-lock.json
Be sure to shrinkwrap your deps, or you may wind up with a dead project. I pulled out a project the other day and it wouldn't run because my deps were all out of date/updated/a mess. If I'd shrinkwrapped, npm would have installed exactly what I needed.
For the curious who make it this far, here is what I recommend:
npm-check-updates
or npm outdated
to suggest the latest versions.# `outdated` is part of newer npm versions (2+)
$ npm outdated
# If you agree, update.
$ npm update
# OR
# Install and use the `npm-check-updates` package.
$ npm install -g npm-check-updates
# Then check your project
$ npm-check-updates
# If you agree, update package.json.
$ npm-check-updates -u
$ rm -rf node_modules
$ npm install
npm-shrinkwrap.json
with npm shrinkwrap
$ rm npm-shrinkwrap.json
$ npm shrinkwrap
npm install
will now use exact versions in npm-shrinkwrap.json
If you check npm-shrinkwrap.json
into git, all installs will use the exact same versions.
This is a way to transition out of development (all updates, all the time) to production (nobody touch nothing).
npm outdated
npm-check-updates
npm shrinkwrap
p.s. Yarn is sending your package list to Facebook.