2

My application uses an yarn package which is installed in local after authentication.Registry url is specified in .npmrc file. Now my build pipeline fails, and says "Package restore failed" (Request failed "401 Unauthorized""). How to authenticate the azure devops build pipeline?

I tried adding a task in my YML file as below , specified the npmrc path in it,so that it silently authenticate from the pipeline process, but this doesn't work

task: npmAuthenticate@0
    inputs:
      workingFile: "Portal/.npmrc"
      customEndpoint: msasg.pkgs.visualstudio.com, 1DS-SDK
      displayName: "Authenticate NPM"

Is there a different way to achieve this?

Deepak Kothari
  • 1,601
  • 24
  • 31

1 Answers1

1

You can try to use Yarn Task from the Marketplace as it is more Azure DevOps aware and can handle this credentials bit for you.

enter image description here

In addition, the yarn package you use is installed locally, do you use a self-hosted agent to run the pipeline ?

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25