Setting up Nexus as private npm registry 🛠​
To use Backpack, make sure to set up Sonatype Nexus as private npm registry.
Retrieve your personal access token from Nexus ​
To retrieve your personal access token, you will need to log in into Sonatype Nexus, and copy the token from your profile.
Make sure to use the base64 representation of "user:password", as shown on the screenshot below:
Update your personal ~/.npmrc
file ​
Using a bash script (recommended) ​
The easiest way to update your npm settings, is by running the following commands:
npm config set @backpack:registry https://nexus.topaas.ns.nl/repository/NS_NSAPP_NPM/
npm config set @ns:registry https://nexus.topaas.ns.nl/repository/NS_CRAWS_NPM_releases/
npm config set //nexus.topaas.ns.nl/repository/NS_CRAWS_NPM_releases/:_auth=$ACCESS_TOKEN
npm config set //nexus.topaas.ns.nl/repository/NS_NSAPP_NPM/:_auth=$ACCESS_TOKEN
Replace the $ACCESS_TOKEN
with your personal token retrieved from Nexus.
These commands will alter your personal ~/.npmrc
file, and instruct npm to use the correct private registries for any package named @ns/*
or @backpack/*
.
Manually ​
Optionally, you can adjust your ~/.npmrc
manually. Make sure it looks like this:
@backpack:registry=https://nexus.topaas.ns.nl/repository/NS_NSAPP_NPM
@ns:registry=https://nexus.topaas.ns.nl/repository/NS_CRAWS_NPM_releases
//nexus.topaas.ns.nl/repository/NS_CRAWS_NPM_releases:_auth=YOUR_TOKEN_HERE
//nexus.topaas.ns.nl/repository/NS_NSAPP_NPM:_auth=YOUR_TOKEN_HERE
IMPORTANT
For security reasons, make sure to NOT include your personal access token in your project's .npmrc
file. Otherwise, you will risk leaking your secret token by accidentally including it in your version control.