Configure pnpm for dependency resolution through Artifactory.

This topic covers the following tasks:

When to Use

Use jf pnpm-config to configure pnpm to resolve packages from Artifactory. After configuration, standard pnpm install commands resolve from your Artifactory repository. For npm-based projects, use jf npm. For Yarn-based projects, use jf yarn.

Prerequisites

  • pnpm must be installed (version 6.x or above).
  • Configure a server with jf config add or jf c add.
  • Authentication to Artifactory is required.
  • Run jf pnpm-config in the project directory before the first build.

Configuration: jf pnpm-config

Generate pnpm configuration for resolving packages through Artifactory. Run this once per project before your first build.

To configure pnpm for Artifactory:

Synopsis

jf pnpm-config [options]

Aliases: pnpmc

Configuration Options

FlagDefaultDescription
--globalfalseSet to true for global configuration (all projects). Specific projects can override.
--server-id-resolveArtifactory server ID for resolution. Configure with jf config add.
--repo-resolveRepository for dependencies resolution

Configuration Examples

View Help

jf pnpm-config --help

Non-Interactive Configuration with Flags

jf pnpm-config --server-id-resolve=<server-id> --repo-resolve=<repo-name>

Where:

  • <server-id>: The server ID configured using jf config add
  • <repo-name>: The name of the npm repository in Artifactory

For example:

jf pnpm-config --server-id-resolve=my-server --repo-resolve=npm-virtual

Why Run Config First?

You must run jf pnpm-config before using pnpm install with Artifactory. The config command creates a .jfrog/projects/pnpm.yaml file in your project directory that sets the pnpm registry to point to your Artifactory repository. Without it, pnpm resolves from the default public npm registry.

Shortcut: In CI/CD, pass all flags non-interactively so the config step is fully automated and reproducible.

Configuration Notes

  • Config-only: There is no jf pnpm run command. After running jf pnpm-config, use standard pnpm commands (pnpm install, pnpm add, etc.) with Artifactory as the registry.
  • Resolution only: pnpm config supports dependency resolution but not deployment. To publish packages, use jf npm publish or native pnpm publish instead.
  • Run once per project: The configuration persists in .jfrog/projects/. Re-run only when changing repository assignments.
  • Global vs project: Use --global to apply to all pnpm projects on the machine. Without it, configuration is project-specific (recommended).

Expected Output

$ jf pnpm-config --server-id-resolve=my-server --repo-resolve=npm-virtual
pnpm build configuration saved successfully.

How to Verify

After running, confirm the configuration exists:

cat .jfrog/projects/pnpm.yaml

After Configuration

After running jf pnpm-config, use standard pnpm commands. JFrog CLI configures the registry to point to Artifactory, so native commands resolve from it automatically:

# 1. Configure once
jf pnpm-config --server-id-resolve=my-server --repo-resolve=npm-virtual

# 2. Use standard pnpm — dependencies resolve from Artifactory
pnpm install

# 3. To publish a package, use jf npm publish or native pnpm publish
pnpm publish

Note: Build-info collection is not currently available for pnpm. If you need build-info, consider using jf npm instead.


Important Notes

  • Config-only: There is no jf pnpm run command. After running jf pnpm-config, use standard pnpm commands with Artifactory as the registry.
  • Resolution only: pnpm config supports dependency resolution. For publishing, use jf npm publish or native pnpm publish.
  • No build-info collection: Unlike jf npm or jf yarn, pnpm does not support build-info collection through JFrog CLI.

CI/CD Example (GitHub Actions)

# .github/workflows/build.yml
steps:
  - uses: actions/checkout@v4
  - name: Setup JFrog CLI
    uses: jfrog/setup-jfrog-cli@v4
    env:
      JF_URL: ${{ vars.JF_URL }}
      JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
  - name: Configure pnpm
    run: jf pnpm-config --server-id-resolve=setup-jfrog-cli-server --repo-resolve=npm-virtual
  - name: Install dependencies
    run: pnpm install

Troubleshooting

SymptomCauseFix
pnpm install does not resolve from Artifactory after configConfig not applied or registry not setRe-run jf pnpm-config and verify with pnpm config get registry
404 on pnpm installResolution repository does not exist or name is wrongVerify the repo name matches an existing npm virtual repository in Artifactory
401 / 403 errorsInvalid credentials or insufficient permissionsRe-run jf config add with a valid access token; check repo permissions
Need build-info collectionpnpm does not support build-infoUse jf npm for build-info collection

Enable debug logging: export JFROG_CLI_LOG_LEVEL=DEBUG


Related Topics