Set Up Yarn with Artifactory

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

For your Yarn package manager to work with Artifactory, you first need to authenticate Yarn with Artifactory by updating your npm config file, (i.e the .npmrc file), with the credentials from Artifactory as follows:

  1. For Yarn to work with Artifactory, you first need to set the default npm registry with an Artifactory npm repository using the following command (the example below uses a repository called npm-repo ):

    npm config set registry https://artifactory.mycompany.com/artifactory/api/npm/<npm repository name>/
  2. Once you have set the default registry, you need to authenticate the npm client to Artifactory.

    npm config set always-auth true
  3. Run the following command in your npm client. When prompted, provide your Artifactory login credentials:

    npm login 

    At this point, the .npmrc file will be updated and will display the following confirmation.

    registry=https://artifactory.mycompany.com/artifactory/api/npm/<npm repository name>/
    
    always-auth=true
    
    //artifactory.mycompany.com/artifactory/api/npm/<npm repository name>/
    
    :_authToken=ACCESS_TOKEN
    

    You can start using Yarn for installing and publishing packages.