Publish and restore npm packages from the command line
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
Using Azure Artifacts, you can easily manage the publication and retrieval of npm packages from various sources, including feeds and public registries like npmjs.com. This article will walk you through setting up your project, and publishing and restoring your npm packages from your Azure Artifacts feed.
Prerequisites
An Azure DevOps organization and a project. Create an organization or a project if you haven't already.
An Azure Artifacts feed. Create a new feed if you don't have one already.
Connect to feed
Sign in to your Azure DevOps organization, and then navigate to your project.
Select Artifacts, and then select your feed from the dropdown menu.
Select Connect to feed, and then select npm from the left.
In the Project setup section, choose Windows if your operating system is Windows; otherwise, select Other. Follow the provided instructions to configure your .npmrc file and connect to your feed. If this is the first time using Azure Artifacts with npm, make sure you Get the tools at the top right corner of the page.
Publish packages
Run the following command in your project directory to publish the npm packages listed in your package.json:
npm publish
Restore packages
Run the following command in your project directory to restore all your npm packages:
npm install
If you want to restore a specific package, run the following command in your project directory:
npm install --save <PACKAGE_NAME>
Related articles
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for