NPM
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
Navigate to the Artifact Registry module in your Harness project.
Click on New Artifact Registry.
In the Registry Type dropdown, select NPM Registry.
Provide a Registry Name.
Optionally, add a Description and Labels for better organization.
Choose visibility between Public and Private.
Click Create Registry to finalize.
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
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.
Publish & Install NPM Packages
Authenticate the CLI with the Harness Registry
In your Harness NPM Artifact Registry, click Setup Client.
Create or update your
~/.npmrcfile with the following content:
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
Build and publish your package:
Install your package
Install your package using npm:
Last updated
Was this helpful?