Share via


Connect to an Azure Artifacts feed - npm

Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022 | Azure DevOps Server 2020

Azure Artifacts enables developers to manage packages from various sources, including public registries like npmjs.com and private feeds. To authenticate with Azure Artifacts, you need to configure your npmrc config file. This file stores feed URLs and credentials used by npm, and it allows you to customize client behavior such as setting up proxies, defining default package locations, or configuring access to private feeds. The npmrc file is typically located in the user's home directory, but can also be created at the project level to override default settings.

Prerequisites

Product Requirements
Azure DevOps - An Azure DevOps organization.
- An Azure DevOps project.
- An Azure Artifacts feed
- Download and install Node.js and npm.

Connect to a feed

Azure Artifacts recommends using two separate .npmrc configuration files. One should be stored locally to store your credentials, while the other should be added to your project directory alongside your package.json to define your feed URL. This approach allows you to share your project-level configuration without exposing sensitive information.

To set up the credentials file, create or update the .npmrc file and include all necessary registry credentials. This enables the npm client to easily access your credentials for authentication.

The following steps guide you through setting up the project-level configuration file. Select the tab that corresponds to your development environment:

  1. Sign in to your Azure DevOps collection, and then navigate to your project.

  2. Select Artifacts, and then select Connect to feed.

    A screenshot showing how to connect to a feed in Azure DevOps Server 2020.1.

  3. Select npm from the left, and then follow the steps in the Project setup section to configure your .npmrc. file and authenticate with your feed.

    A screenshot showing how to set up your npm project in Azure DevOps Server 2020.1.

Tip

Using multiple registries in .npmrc files is supported with scopes and upstream sources.