npm install <packagename>
, the latest available version of the package is downloaded and put in the node_modules
folder, and a corresponding entry is added to the package.json
and package-lock.json
files that are present in your current folder.cowsay
, a cool command line tool that lets you make a cow say things.npm install cowsay
, this entry is added to the package.json
file:package-lock.json
, where I removed the nested dependencies for clarity:1.3.1
of cowsay, and our rule for updates is ^1.3.1
, which for the npm versioning rules means that npm can update to patch and minor releases: 1.3.2
, 1.4.0
and so on.2.0
and higher.npm update
, the installed version is updated, and the package-lock.json
file diligently filled with the new version.package.json
remains unchanged.npm outdated
.npm update
won’t update the version of those. Major releases are never updated in this way because they (by definition) introduce breaking changes, and npm
want to save you trouble.npm-check-updates
package globally:package.json
file, to dependencies
and devDependencies
, so npm can install the new major version.node_modules
dependencies and you want to install the shiny new versions first, just run.nuspec
or project file used to create the package.-alpha
: Alpha release, typically used for work-in-progress and experimentation.-beta
: Beta release, typically one that is feature complete for the next planned release, but may contain known bugs.-rc
: Release candidate, typically a release that's potentially final (stable) unless significant bugs emerge.Notation | Applied rule | Description |
---|---|---|
1.0 | x ≥ 1.0 | Minimum version, inclusive |
(1.0,) | x > 1.0 | Minimum version, exclusive |
[1.0] | x 1.0 | Exact version match |
(,1.0] | x ≤ 1.0 | Maximum version, inclusive |
(,1.0) | x < 1.0 | Maximum version, exclusive |
[1.0,2.0] | 1.0 ≤ x ≤ 2.0 | Exact range, inclusive |
(1.0,2.0) | 1.0 < x < 2.0 | Exact range, exclusive |
[1.0,2.0) | 1.0 ≤ x < 2.0 | Mixed inclusive minimum and exclusive maximum version |
(1.0) | invalid | invalid |
packages.config
format.packages.config
files, and .nuspec
files. Without a version or version range, NuGet 2.8.x and earlier chooses the latest available package version when resolving a dependency, whereas NuGet 3.x and later chooses the lowest package version. Specifying a version or version range avoids this uncertainty.packages.config
:packages.config
, every dependency is listed with an exact version
attribute that's used when restoring packages. The allowedVersions
attribute is used only during update operations to constrain the versions to which the package might be updated..nuspec
filesversion
attribute in a <dependency>
element describes the range versions that are acceptable for a dependency.pack
and restore
operations normalize versions whenever possible. For packages already built, this normalization does not affect the version numbers in the packages themselves; it affects only how NuGet matches versions when resolving dependencies.