Get started with npm packages in Azure Artifacts
Azure DevOps Server 2019
Using Azure Artifacts, you can publish and download your npm packages from feeds and public registries such as npmjs.com. This quickstart will guide you through creating your feed, configuring your project, and managing npm packages with your Azure Artifacts feed.
Prerequisites
An Azure DevOps organization. Create one for free.
An Azure DevOps project. Create a new project if you don't have one already.
Create a feed
Sign in to your Azure DevOps server, and then go to your project.
Select Artifacts, and then select New feed.
For Name, enter a descriptive name for your feed.
For Visibility, select an option to indicate who can view packages within the feed.
If you want to include packages from public sources, select the Use packages from public sources through this feed option.
Select Create when you're done.
Note
By default, newly created feeds have their project's Build Service value set to Feed and Upstream Reader (Collaborator).
Connect to a feed
Note
vsts-npm-auth
is not supported in Azure DevOps Server.
Azure Artifacts recommends using two .npmrc files. The first one should be placed in the $home directory (Linux/macOS) or $env.HOME (Windows) to securely store your credentials. This allows the npm client to locate the file and retrieve your credentials for authentication, enabling you to share your config file without exposing your credentials. In this section, we will set up the second .npmrc file, which should be placed in the same directory as your package.json file.
Sign in to your Azure DevOps collection, and then navigate to your project.
Select Artifacts, and then select Connect to feed.
A new window will appear. From the left navigation pane, select npm and follow the instructions to set up your project and user .npmrc files.
Important
npm supports a single registry
in your .npmrc file. Multiple registries are possible with scopes and upstream sources.
Publish packages
Run the following command in your project directory to publish your npm packages:
npm publish
Important
Using the publishConfig
property to override the registry config param at publish-time is not supported.
Restore packages
Run the following command in your project directory to restore your npm packages:
npm install
To restore a specific npm package, run the following command from your project directory:
npm install --save <PACKAGE_NAME>