Publish npm Packages with pnpm

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Configure pnpm to publish packages to Artifactory by adding the target repository to the package.json file. You can also specify the repository name in the pnpm publish command to override the configured target repository.

Note

If you run pnpm publish without configuring the package.json file, the package publishes to the default repository in the .npmrc file. Configuring the package.json is an optional override to publish a specific package to a different repository.

To set up pnpm to publish packages to Artifactory:

  1. Add the following snippet to your package.json file:

    "publishConfig":{"registry":"[JFrogPlatformURL]/artifactory/api/npm/<REPO_NAME>/"}

    Where:

    • [JFrogPlatformURL]: The URL of your JFrog service endpoint

    • <REPO_NAME>: The name of the target repository

    For example:

    "publishConfig":{"registry":"https://company.jfrog.io/artifactory/api/npm/npm-local/"}
  2. Run the following command:

    pnpm publish

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

To publish to a specific repository:

Run the following command:

pnpm publish --registry [JFrogPlatformURL]/artifactory/api/npm/<REPO_NAME>/

Where:

  • [JFrogPlatformURL]: The URL of your JFrog service endpoint

  • <REPO_NAME>: The name of the target repository

For example:

pnpm publish --registry https://company.jfrog.io/artifactory/api/npm/npm-local/

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.