แก้ไข

แชร์ผ่าน


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 your npm packages from various sources, including feeds and public registries like npmjs.com. This article walks you through setting up your project, publishing, and restoring your npm packages from your Azure Artifacts feed.

Prerequisites

Connect to Feed

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

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to Feed, and then select npm from the left navigation area.

  4. Follow the instructions in the Project setup section to configure your .npmrc file and connect to your feed.

    Screenshot that shows how to connect to a feed in Azure DevOps services.

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

  2. Select Artifacts, and then select your feed from the dropdown menu.

  3. Select Connect to Feed, and then select npm from the left navigation area.

  1. Follow the instructions in the Project setup section to connect to your feed.

    A screenshot that shows how to connect to your feed in Azure DevOps Server 2022.

  1. Follow the instructions in the Project setup section to connect to your feed.

    A screenshot that shows how to connect to your feed in Azure DevOps Server 2020.

  1. Follow the provided instructions to set up your project and connect to your feed.

    A screenshot that shows how to connect to your feed in Azure DevOps Server 2019.

Publish packages

  1. Run the following command in your project directory to publish the npm packages listed in your package.json:

    npm publish
    

Restore packages

  1. Run the following command in your project directory to restore all your npm packages:

    npm install
    
  2. If you want to restore a specific package, run the following command in your project directory:

    npm install --save <PACKAGE_NAME>