Configure Private NPM Packages

Vinh
Vinh
  • Updated
This feature is not available for teams on Free or Starter.

You may require help from a more technical team member if you are not familiar with private registries.

If you wish to import NPM packages hosted on a private registry, you can do so by adding authentication details to zeroheight. Note: We proxy registries through zeroheight.com, so we don't currently support adding private registries behind VPNs.

  1. Navigate to 'Your organization' settings page and click 'Developers' on the sidebar
  2. You'll see an NPM Registry section; click the Add registry button to bring up the creation modal
  3. Fill out each of the fields in the modal and click save:
  • Registry name: a label used only within zeroheight
  • URL: The URL of the registry, e.g. for a private package on NPM, you would use "https://registry.npmjs.org"
  • Scopes: A comma separated list of scopes that will be associated with the registry (these should begin with an "@")
  • Authentication method:
    • Token: This provides a single authentication token field, which allows accessing private registries using bearer authentication
    • Username & password: This provides a username and password field, which allows accessing private registries using basic authentication
  • Skip credentials check: This stops zeroheight from verifying credentials before saving. Certain registries, including Azure Artifacts and GitLab, don't support our method of credentials verification, so this option to bypass our checks on save.

4. Once completed, click Add registry

You will then need to add any packages that use the private NPM registry in the styleguide settings. Note: you will need to import any dependancies required for private packages to compile

After configuration, any matching scoped packages added to code blocks will refer to the created registry.

Adding an Artifactory private NPM registry

To add a JFrog Artifactory registry to zeroheight, you must add either an Identity token or a Scoped token.

To add an identity token:

  1. Go to "Edit profile" in your JFrog account and click "Generate an Identity token"
  2. Add the token to the registry in zeroheight with the authentication method set to Token

More information available in their help article

To add a scoped token:

  1. Go to "Configuration > User Management > Access Tokens" in your JFrog account
  2. Create a new scoped token
    • Check the 'create reference token' checkbox and use the returned reference token
    • Ensure you have the correct permissions in Artifactory

More information available in their help article

Adding an Azure DevOps private NPM registry

To add an Azure DevOps private NPM registry, you must create a Personal Access Token:

  1. Go to your organisation in Azure DevOps
  2. Open the User Settings drop down and select "Personal Access Tokens"
  3. Click the "New Token" button
  4. Make sure you select the correct organisation and that the token has Read access for Packaging
  5. Copy the token

More information about Personal Access tokens is available in their help article

To get the url of the registry:

  1. Go to the feed in Azure DevOps
  2. Click the "Connect to Feed" button
  3. Select "npm"
  4. Copy the url after registry=. It should look something like https://pkgs.dev.azure.com/my_org/my_project/_packaging/my_feed/npm/registry/

Once you have both of those you can connect zeroheight to the npm registry

  1. Paste in the URL from your feed in Azure DevOps
  2. Set the authentication method to Token and paste in the token you copied earlier

Was this article helpful?