Configuration
To use the Quantum libraries, you need an Artifactory account.
-
Request an Artifactory account.
-
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.
- Go to your Artifactory profile settings.
- Click on the "Generate Identity Token" button.
- A popup will appear where you can add an optional description. Fill in the description if desired, then click "Next".
- 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:
- macOS
- Windows
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
curl.exe -u <user_email>:<identity_token> https://artifactory.thalesdigital.io/artifactory/api/npm/auth >> C:/Users/<YourUsername>/<ProjectPath>/.npmrc
After that, open your C:/Users/<YourUsername>/<ProjectPath>/.npmrc
file to add a scope. Replace _auth
with //artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth
:
- _auth=<identity_token>
+ //artifactory.thalesdigital.io/artifactory/api/npm/npm/:_auth=<identity_token>
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:
npm init -y
will create apackage.json
file with default settings.npm install bootstrap -D
to verify access to public registry packages.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.
- Open your
.npmrc
file in a text editor (e.g., Notepad++). - 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").
- Remove any NUL characters.
- Clear any unnecessary spaces between characters.
- Save the file.
- 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.