Skip to main content
🏠Getting StartedConfigurationVersion: 2.0.0-beta.16

Configuration

Prerequisite

To use the Quantum libraries, you need an Artifactory account.

  1. Request an Artifactory account.

  2. After receiving confirmation that your access has been granted, log in to the Artifactory platform using your credentials.

To set up your .npmrc file so it uses an Artifactory registry instead of the default npm registry, you'll need to configure the registry URL in your npm configuration.

Here's a step-by-step guide to configure your .npmrc file.

Setting up the Registry

To enable your package manager client to work with Artifactory, set the default npm registry URL by running the following command:

npm config set registry https://artifactory.thalesdigital.io/artifactory/api/npm/npm/

Generating an Artifactory Identity Token

To authenticate with Artifactory, generate an identity token from your profile.

  1. Go to your Artifactory profile settings.
  2. Click on the "Generate Identity Token" button.
  3. A popup will appear where you can add an optional description. Fill in the description if desired, then click "Next".
  4. Copy the generated "Reference Token".

Setting up Authentication

To authenticate with your identity token, run the following command using the identity token you copied earlier:

curl -u <user_email>:<identity_token> https://artifactory.thalesdigital.io/artifactory/api/npm/auth | sed 's/^_auth/\/\/artifactory.thalesdigital.io\/artifactory\/api\/npm\/npm\/:_auth/' >> ~/.npmrc

Verifying the Configuration

After configuring your .npmrc file, verify its contents to ensure the authentication token is correctly set up.

Your .npmrc file should look like this:

always-auth=true
registry=https://artifactory.thalesdigital.io/artifactory/api/npm/npm/
//artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth=<auth_token>

Testing Registry Access

To test the configuration, create a temporary directory and run the following commands within it:

  1. npm init -y will create a package.json file with default settings.
  2. npm install bootstrap -D to verify access to public registry packages.
  3. npm install @qtm/tokens -D to verify access to private registry packages.

If all commands execute successfully, your configuration is correct.

Troubleshooting

Formatting Issues

For Windows users, ensure the file encoding is set to UTF-8 and remove any NUL characters that may have been automatically added.

  1. Open your .npmrc file in a text editor (e.g., Notepad++).
  2. Convert the file encoding to UTF-8 (e.g., select all content, then go to "Encoding" in the toolbar of Notepad++ and choose "Convert to UTF-8").
  3. Remove any NUL characters.
  4. Clear any unnecessary spaces between characters.
  5. Save the file.
  6. Re-run the installation command.

ERR_INVALID_AUTH

You might encounter the following error when running npm commands:

npm error code ERR_INVALID_AUTH
npm error Invalid auth configuration found: `_auth` must be renamed to `//artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth` in user config
npm error Please run `npm config fix` to repair your configuration.`

Try executing npm config fix to repair your configuration:

$ npm config fix
The following configuration issues have been repaired:
~ `_auth` renamed to `//artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth` in user config

If this does not resolve the issue, manually update your .npmrc file to replace _auth with //artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth.

HTTP 401 Unauthorized Error

If your credentials are correct but you encounter an HTTP 401 Unauthorized error, it may be due to incorrect permissions.

Please submit a support ticket to resolve the issue.