For the complete documentation index, see llms.txt. This page is also available as Markdown.

NPM

spinner

Prerequisites

  • Ensure you have the NPM CLI (npm) installed on your local machine.

  • Access to a Harness account with appropriate permissions to create registries and connectors.


Create a NPM Artifact Registry

Create NPM Artifact Registry in Harness
  1. Navigate to the Artifact Registry module in your Harness project.

  2. Click on New Artifact Registry.

  3. In the Registry Type dropdown, select NPM Registry.

  4. Provide a Registry Name.

REGISTRY NAME CRITERIA

Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.

  1. Optionally, add a Description and Labels for better organization.

  2. Choose visibility between Public and Private.

  3. Click Create Registry to finalize.

PRIVATE REGISTRY

This registry will serve as your private NPM registry within Harness.


Configure an Upstream Proxy (Optional)

An upstream proxy allows your registry to fetch NPM packages from external sources if they are not available locally.

Create an upstream proxy

Create NPM Upstream Proxy in Harness

Configure the upstream proxy in your registry

Configure NPM Upstream Proxy in Harness

Create an upstream proxy

1. In the Artifact Registry module, click the dropdown next to **New Artifact Registry** and select **Upstream Proxy**. 2. Choose **NPM Registry** as the proxy type. 3. Click **Create Proxy** to establish the connection.

Configure the upstream proxy in your registry

1. In the Artifact Registry module, select an existing Artifact Registry. 2. Select the **Configuration** tab. 3. Under **Advanced (Optional)**, select **Configure Upstream**. 4. Select from the list of compatible proxies to add them to your registry. 5. Click **Save** to save the configuration.

UPSTREAM PROXY CACHING

If a NPM package isn’t found in your Harness registry, the upstream proxy fetches it from an external registry like NPM Central, reducing duplication and improving resolution.


Publish & Install NPM Packages

Authenticate the CLI with the Harness Registry

  1. In your Harness NPM Artifact Registry, click Setup Client.

  2. Create or update your ~/.npmrc file with the following content:

  1. Click Generate Identity Token to generate a new token that serves as the password for uploading and downloading artifacts.

Publish a Package to the Registry

  1. Build and publish your package:

Install your package

  1. Install your package using npm:

USAGE

These commands upload or retrieve NPM packages between your local project and the Harness registry.


Last updated

Was this helpful?