Private NodeJS packages

Learn how to distribute your private NodeJS packages.

Requirements

The package scope must match the product identifier in order to work. So make sure you adjust your package.json and set the package name to @your-product-identifier/package-name }}:

1{
2 "name": "@your-product-identifier/hello-world",
3 "version": "1.0.0",
4 "description": "Cool product description",
5 //...
6}

Installation instructions

First, add the following repository to the npm or yarn config with the following command.

1# NPM
2npm config set @your-product-identifier:registry 'https://your-product-identifier.nodejs.pub'
3 
4# Yarn
5yarn config set @your-product-identifier:registry 'https://your-product-identifier.nodejs.pub'

Next, they will need to set their license key (and fingerprint if applicable).

1# NPM
2npm config set '//your-product-identifier.nodejs.pub/:_authToken' '[license-key]'
3 
4# Yarn
5yarn config set '//your-product-identifier.nodejs.pub/:_authToken' '[license-key]'

If your license policy requires a fingerprint the user will need to append his/her fingerprint to their license key. For example, let's say we have the following licensee and license activation:

  • License key: aaaff29c-94e7-4d59-ab95-86b4248d9443
  • Activation fingerprint: anystack.sh

This will require your licensee to set the following config:

1# NPM
2npm config set '//your-product-identifier.nodejs.pub/:_authToken' 'aaaff29c-94e7-4d59-ab95-86b4248d9443:anystack.sh'
3 
4# Yarn
5yarn config set '//your-product-identifier.nodejs.pub/:_authToken' 'aaaff29c-94e7-4d59-ab95-86b4248d9443:anystack.sh'

Next, run the install command by using the correct scope and package name:

1# NPM
2npm install @your-product-identifier/hello-world
3 
4# Yarn
5npm add @your-product-identifier/hello-world