# Artillery pro > Private npm packages

# Using private npm packages

> **Info:** **What you'll learn**
>
> * How to configure Artillery Pro to be able to install private packages from `npm`
> * How to configure Artillery Pro to be able to install private packages from Artifactory
> * How to allow arbitrary customization of `.npmrc` in Artillery workers

## Overview

If your test scripts make use of custom JS code depending on private packages, you can enable private `npm` module support in Artillery Pro by setting a couple of configuration options. Private packages hosted on [npmjs.com](https://www.npmjs.com) and [Artifactory](https://jfrog.com/artifactory/) are supported.

## Configure private access for npmjs.com

> **Info:** When configuring private access for npmjs.com, you must specify the AWS region
> where [your Artillery Pro backend is
> deployed](/guides/getting-started/installing-artillery-pro#Deploy-the-backend-with-artillery-deploy).
> The configuration will get encrypted and stored securely in [AWS Parameter
> Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store)
> and can only be read by Artillery Pro tests.

### Set npm token

If you want to use a private package hosted on [npmjs.com](https://www.npmjs.com), you need to configure an npm token that Artillery Pro can use to fetch your private packages. Please refer to the [npm documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens) for information on creating an access token. We recommend that you create a `read-only` token to follow security best practices.

Once you have a read-only token, use the `artillery set-config-value` command to configure the `NPM_TOKEN` config value to make it available to Artillery Pro.

```sh
artillery set-config-value \
  --name NPM_TOKEN \
  --value 01234567890-token-from-npm-012345 \
  --region eu-west-1
```

### Set npm registry URL

If your organization uses a self-hosted NPM registry, the URL for the registry can be configured with the `NPM_REGISTRY` config value.

```sh
artillery set-config-value \
    --name NPM_REGISTRY \
    --value https://npm.internal.acmecorp.digital \
    --region eu-west-1
```

## Configure access to an Artifactory npm registry

> **Info:** When configuring private access for Artifactory, you must specify the AWS
> region where [your Artillery Pro backend is
> deployed](/guides/getting-started/installing-artillery-pro#Deploy-the-backend-with-artillery-deploy).
> The configuration will get encrypted and stored securely in [AWS Parameter
> Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store)
> and can only be read by Artillery Pro tests.

### Set Artifactory auth

Artillery Pro supports accessing modules hosted in a private [Artifactory](https://jfrog.com/artifactory/) registry using [Basic Authentication](https://www.jfrog.com/confluence/display/JFROG/npm+Registry#npmRegistry-UsingBasicAuthentication). Please refer to the [official Artifactory documentation](https://www.jfrog.com/confluence/display/RTF/npm+Registry) for information on how to acquire your Base64-encoded authentication string.

Once you have the authentication string, use the `artillery set-config-value` command to configure the `ARTIFACTORY_AUTH` config value to make it available to Artillery Pro.

```sh
artillery set-config-value \
    --name ARTIFACTORY_AUTH \
    --value replaceWithAuthString \
    --region eu-west-1
```

You will also need to set the `ARTIFACTORY_EMAIL` config value to the associated email address:

```sh
artillery set-config-value \
    --name ARTIFACTORY_EMAIL \
    --value myemail@example.net \
    --region eu-west-1
```

### Set Artifactory registry URL

Set the `NPM_REGISTRY` config value to the URL of your organization's Artifactory npm registry:

```sh
artillery set-config-value \
    --name NPM_REGISTRY \
    --value http://<ARTIFACTORY_SERVER_DOMAIN>:8081/artifactory/api/npm/ \
    --region eu-west-1
```

## Running tests using private modules

Once configuration values for private registry access have been configured, tests making use of private modules can be run as normal with the [`artillery run-test` command](/guides/guides/command-line#run-test). No changes to the test scripts are necessary.

## Advanced `.npmrc` configuration

If you require further customizations to the npm configuration in Artillery workers running on ECS or Fargate, additional `.npmrc` configuration settings can be added by setting the `NPMRC` config value. The contents of `NPMRC` will get added as-is to `.npmrc` before `npm` runs in ECS/Fargate containers.

For example, the following config value will enable debug-level logs for `npm`:

```sh
artillery set-config-value \
    --name NPMRC \
    --value "loglevel=debug" \
    --region eu-west-1
```

To see available configuration options for `.npmrc`, please refer to the [npm config files documentation](https://docs.npmjs.com/files/npmrc).
