
Updating to close-by version with npm update Here's the correct way to update dependencies using only npm from the command line. Semantic versioning screws things just enough, so it's safer to manually edit package.json than to attempt npm acrobatics. It's hard to update a new version of a library. Outdated - that is, has a version that is different from latest.Updating to close-by version with npm update Updating Globally-Installed Packages npm update -g will apply the update action to each globally- installed package that is Note that npm will only write an updated version to package.json if it installs a new

Then npm update -save will install (i.e., latest), and package.json will be When you want to update a package and save the new version as the minimum requiredĭependency in package.json, you can use npm update -S or npm update -save. Points to 1.2.2, this version does not satisfy ~1.1.1, which is equivalent to >=1.1.1 = 0.4.0 -save In this case, running npm update will install Even though the latest tag Then npm update will install because 1.2.2 is latest and 1.2.2 satisfies Npm, you must specify -depth 0 to get the behavior described below.įor the examples below, assume that the current package is app and it depends onĭependencies, dep1 ( dep2. IMPORTANT VERSION NOTE: these examples assume or later. To restore a missing npm, use the command: Including the uninstallation of npm itself.

Including npm itself and packages that npm depends on, often causes problems up to and To get the old behavior, use npm -depth 9999 update, but be warned that simultaneous asynchronous update of all packages,

Npm would also recursively inspect all dependencies. If no package name is specified, all packages in the specified location (global or local)Īs of the npm update will only inspect top-level packages. If the -g flag is specified, this command will update globally installed packages. dev flag will cause devDependencies to be processed as well. As with all commands that install packages, the This command will update all the packages listed to the latest version (specified by the
