Install npm Packages using Distribution Tags

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Install npm Packages with Distribution Tags

You can add distributions tags to your npm install command to install specific versions of a package based on the tags. By default, the npm install command returns the first package with the tag that appears in the priority resolution order you configured. For more information on repository configurations, see Repositories Configurations in Artifactory YAML.

To install a package with distribution tags:

Run the following command:

npm install <PACKAGE_NAME>@<DIST_TAG> 

Where:

  • <PACKAGE_NAME>: The name of the package you want to install, including the @<SCOPE>/ prefix for scoped packages

  • <DIST_TAG>: The target distribution tag

For example:

npm install colors@beta

Configure Distribution Tag Behavior in Artifactory YAML

Starting from Artifactory version 7.75.3, you can modify distribution tag behavior using system properties in your Repositories Configurations in Artifactory YAML file.

  • To install the latest SemVer version of the package with the dist-tag in your priority resolution repositories, set the following system property:

    artifactory.npm.merge.latest.dist.tag.base.strategy.enabled=true
  • To install the most recently created version of the package with the dist-tag in your priority resolution repositories, set the following system properties:

    artifactory.npm.merge.latest.dist.tag.base.strategy.enabled=true
    artifactory.npm.tag.tagLatestByPublish=true