Reputation: 2740
Here is an example command for installing npm v2 instead of latest (which is v3):
npm install -g npm@latest-2
How does this syntax work?
Usually I use either latest
or explicit version, but haven't seen such syntax before.
I've tried something similar with other packages, for example:
npm install express@latest-4
but it fails with error No compatible version found: express@latest-4
Upvotes: 0
Views: 194
Reputation: 35797
These are called tags, and they're intended to allow developers to label particular versions of their packages in a more human readable way.
By default, all versions are tagged as latest
, but say you have a beta version that you want some users to test - rather than making them specify a particular version to install, you can tag your betas with npm publish --tag beta
. This will then allow them to run npm install mypkg@beta
to get the latest beta version.
You can also tag a version after you've already published by using npm dist-tag add <pkg>@<version> [<tag>]
.
See https://docs.npmjs.com/getting-started/using-tags for more info.
Upvotes: 2