Skip to main content

Personal Access Token

Introduction

Before delving into any configuration, let's establish your personal access token in GitLab. This token will allow you to access private packages hosted in Acro Commerce's GitLab registry.

Generating your Access Token

  1. Click here to generate your Access Token
  2. Name the token meaningfully (e.g. desktop workstation - npm private registry)
  3. Select the API Scopes you need (see below for how to choose)
  4. Click the Create personal access token button
  5. Copy the created token into your ~/.npmrc file (see below for more information)
info

Token Name

We recommend something similar to desktop workstation - npm private registry so that it’s easy to keep track of and revoke if needed.

API Scopes

If you need to be able to publish from your local machine select the following api scope options: read_registry, write_registry & read_api. That will give you read/write access to the npm registry. If you only need read access for downloading and installing packages select only read_api.

The .npmrc file

Placing your ~/.npmrc file at the root of your home directory will work when using Node.js locally (i.e. not within containers).

If you don't use Node.js locally (i.e. you only use Node.js from within containers):

  • You will need to place a .npmrc file in the root of your project directory instead.
  • Double check that .npmrc is specified in the project's .gitignore file. Committing your gitlab personal token is the same thing as committing your private ssh key: It grants anyone who sees it the abiltity to act as you.
  • Symlinking (or hard linking) the .npmrc file from your home directory to the project directory won't work.

Example .npmrc file:

@acromedia:registry=https://git.acromedia.com/api/v4/packages/npm/
//git.acromedia.com/api/v4/packages/npm/:_authToken=YOUR_PERSONAL_TOKEN_VALUE
//git.acromedia.com/api/v4/projects/:_authToken=YOUR_PERSONAL_TOKEN_VALUE
caution

If you have already installed your project, you might need to execute the pnpm cache clean command to ensure the changes take effect. In certain cases, users have also reported the need to remove the node_modules directory before running pnpm install.