For example:
2.0.0
of package-name
installed.2.1.2
npm install package-name@latest
is 4.3.0
How can I install the most recent package that does not have breaking changes?
To update a specific package, we need to run the npm update command followed by the package name. Sometimes, you want to update a package to the specific version in such cases you need to use npm install command by specifying a version number after the package name.
The Semantic Versioning concept is simple: all versions have 3 digits: x.y.z . the first digit is the major version. the second digit is the minor version.
The command is npm install npm@latest -g to install it globally. This will install the latest version that will run with the node. js you have installed. Additionally you can install a specific version of npm to your package.
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
Use npm install package-name@"<next-major.0.0"
For example:
npm install package-name@"<3.0.0"
would install the latest right before 3.0.0 (e.g. 2.11.1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With