How to install beta version via npm

Viewed 17753

I need to install a beta version 3.0.0 of react-docgen.

Is it possible to install a beta version via npm?

3 Answers

Yes, it's possible to install a beta version using the @ symbol. For example to install react-docgen (v3.0.0-beta7) run the following command:

npm install -g react-docgen@3.0.0-beta7

Further information about installing specific versions can be found in the npm-install documentation.

The syntax for npm install includes both of the following overloads:

npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>

For tag, you can specify either @latest and @beta like this:

npm install @11ty/eleventy@latest  # latest stable release
npm install @11ty/eleventy@beta    # latest beta release

Interestingly, if you don't specify a tag, the default, set by your npm config, is @latest

You can also find out which versions are available by running npm view

npm view @11ty/eleventy

npm view

To install a specific beta version:

npm install -g react-docgen@3.0.0-beta7
//or
yarn global add react-docgen@3.0.0-beta7  // if you use yarn

P.S.:

In order to see all versions of a package (including alpha, beta , pre-release, release):

npm show <package> versions --json

Example:

npm show react-docgen versions --json

enter image description here


You can also install a certain version using a tag!

npm install <name>@<tag>

In order to see which tags are available for this package, you have to run:

npm view react-docgen

enter image description here

A tag can be used when installing packages as a reference to a version instead of using a specific version number (alias)

Related