Publish npm packages

Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017


In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, service connections are called service endpoints, stages are called environments, and jobs are called phases.

You can publish npm packages produced by your build to:

  • Azure Artifacts or the TFS Package Management service.
  • Other registries such as

Before you read this topic, you should understand the kind of build pipeline you're creating: designer or YAML.

To publish to an Azure Artifacts feed, set the Project Collection Build Service identity to be a Contributor on the feed. To learn more about permissions to Package Management feeds, see Secure and share packages using feed permissions. Add the following snippet to your azure-pipelines.yml file, where useFeed is the codename for using an Azure Artifacts feed, and feedName is the feed that you want to publish to:

- task: Npm@1
    command: publish
    publishRegistry: useFeed
    publishFeed: feedName

To publish to an external npm registry, you must first create a service connection to point to that feed. You can do this by going to Project settings, selecting Services, and then creating a New service connection. Select the npm option for the service connection. Fill in the registry URL and the credentials to connect to the registry.

To publish a package to an npm registry, add the following snippet to your azure-pipelines.yml file.

- task: Npm@1
    command: publish
    publishEndpoint: '<copy and paste the name of the service connection here>'

For a list of other options, see the npm task.

YAML is not supported in TFS.


The build does not support using the publishConfig property to specify the registry to which you're publishing. Ensure that your working folder has an .npmrc file with a registry= line, as detailed in the Connect to feed screen in your feed.


Where can I learn about the Azure Pipelines and TFS Package Management service?

Package Management service