
Also notice how the -global flag works with both individual package arguments and no arguments. npm update -global npm update express -gīoth -global and -g do the same thing. Npm update will update packages globally if the global flag is specified. Using the -save flag is important for updating the package.json.įor more information on updating packages to a specific version, see npm install | how it works. If you want to update a package to specific version, use npm install with the specified tag instead. npm update express npm update to specific version If packages are specified then only those packages will be updated. npm update -save-dev npm update -devīoth -save-dev and -dev do the same thing. Just like npm install, if the -save-dev flag is specified, npm update will update devDependencies as well. If no packages are specified, npm update will update every (non-dev) dependency listed in package.json. Instead, npm will install the latest version of dep1 that also satisfies semvar (if there is one). This means if the latest version of dep1 is 1.3.0 but your package.json specifies "dep1" : "~1.2.3" you wont get the latest version. Npm update also installs missing packages. Make sure you back up the dependencies list before you do, though.Īnd that’s how you update all npm packages installed as dependencies on your project.Npm update update packages to their latest stable versions. Repeat this until all packages are updated to the latest major version.īut of course, you are free to run ncu -u if you want to. Once you’re certain the application is running fine, update another package. Update one package, then check if the update causes any issue. The safer way to update major package versions is to use the npm install command.

The reason why npm update follows the semantic rules is to help you transition any package update gracefully, letting you inspect the application for any issue.


This is because updating the major version of multiple packages at once could break your application. I don’t recommend you to use npm-check-updates, however. Once done, you need to run npm install to get the latest versions.
