update
update all the packages listed to the latest version (specified by the tag config), respecting semver.
- npm-update docs
update all the packages listed to the latest version (specified by the tag config),
respecting the semver constraints of both your package and its dependencies (if they also require the same package).
This will also install any missing packages. i.e. if you deleted anything from node_modules
or if you added to package.json
without doing npm install
.
Related
- install command cheatsheet
- outdated command cheatsheet
- Install packages cheatsheet
- Maintain packages cheatsheet
- Upgrade packages cheatsheet
- Upgrade packages with GH Actions recipe in Code Cookbook.
Upgrade all
$ npm update
This will give as success exit status, even if nothing was upgraded.
Upgrade one
update command
$ npm update PACKAGE_NAME
e.g.
$ npm update foo
$ # Multiple
$ npm update foo bar bazz
Which could result in change in package.json
:
- "foo": "^1.0.0"
+ "foo": "^1.2.3"
But, the package will remain within the initial bounds. So the command here would not upgrade from 1
to 2
. See the sections below for that.
install and ugprade
To get the same result, you can use install
with an upgrade flag.
$ npm install --upgrade PACKAGE_NAME
Ignore scripts
Turn off pre- and post-install scripts.
$ npm update --ignore-scripts
Global
$ npm update --global
$ npm update -g