Artifactory (NPM)
3 Easy Steps
Teams using JFrog Artifactory can manage access to NES packages through 3 easy steps:
- Create a Remote Repository for our private NPM registry.
- Configure (or create) a Virtual Repository to leverage the newly created Remote Repository.
Important
This Virtual Repository is mandatory as a misconfiguration will lead to Artifactory seeking all NPM packages from us. Failure to configure this correctly may result in suspension of your access token.
- Verify your developers are able to access our package through your Virtual Repository.
Step 1: Create a Remote Repository
- Navigate to the Administration tab (top navbar next to Application)
- Select Repositories (left side navbar)
- Navigate to the Remote subtab.
- Select Create Repository > Remote, and then select NPM as the type.
- Configure the following parameters on the Basic tab:
- Repository Key: nes (or whatever alias your team prefers)
- URL: https://registry.nes.herodevs.com/npm/pkg
- Username: artifactory
- Password: <NES_ACCESS_TOKEN>
- Include Patterns:
- Click the X to delete the default **/* pattern
- Add .npm/@neverendingsupport/**
- Add @neverendingsupport/**
- Remote Mapping Layout: npm-default
- Configure the following on the Advanced tab:
- Ensure Bypass HEAD Requests is checked
- Ensure Disable URL Normalization is checked
The final results should look similar to the following:
Basic
Advanced
Note
Our registry DOES NOT implement every endpoint in the public NPM registry. As such, some Artifactory features may not function as expected, such as the "Test" button or various search features.
Step 2: Configure a Virtual Repository
In this step, you should configure the virtual repository referenced in the .npmrc
files. This step is fairly straight forward, and only requires adding our private NPM registry after the public npmjs.org
registry.
If you don't already have a Remote repository configured a for npmjs.org:
- Create a Remote repository with below parameters, the rest of the default set up should be fine.
- Repository Key: npm-remote
- URL: https://registry.npmjs.org
If you don't already have a Virtual repository configured with npm-remote
- Begin with the repository creation steps below, otherwise you can skip creating a new Virtual repository and configure your existing one.
- Navigate to the Administration tab
- Select Repositories
- Navigate to Virtual subtab
- Select Create Repository > Virtual
Whether creating or editing a new Virtual Repository, ensure both "npm-remote" and "nes" repositories are included in Selected Repositories with "nes" at the bottom of the list.
In most versions of Artifactory, you should see the following:
Step 3: Verify Access
With your Virtual Repository keyed as npm-default and assuming that you have a valid Artifactory username / password, configure your .npmrc
accordingly:
registry=<artifactory_url>/artifactory/api/npm/<virtual_repository_key>/
<artifactory_url>/artifactory/api/npm/<virtual_repository_key>/:_password=<base64_artifactory_password>
<artifactory_url>/artifactory/api/npm/<virtual_repository_key>/:username=<artifactory_email>
<artifactory_url>/artifactory/api/npm/<virtual_repository_key>/:email=<artifactory_email>
<artifactory_url>/artifactory/api/npm/<virtual_repository_key>/:always-auth=true
The above will replace the following if your .npmrc
file already contains the following (i.e. you are already using our product and are integrating Artifactory after the fact):
@neverendingsupport:registry=https://registry.nes.herodevs.com/npm/pkg/
//registry.nes.herodevs.com/npm/pkg/:_authToken=<NES_ACCESS_TOKEN>
Once configured, Artifactory will attempt to download packages under the @neverendingsupport
namespace from our private registry. Run npm install
in a project containing a @neverendingsupport
dependency in it to verify that you are properly set-up.