1
votes

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?

1
Do you use Yarn task in the pipeline? Can you share your build definition?Hugh Lin
This could be a misalignment between .npmrc and the registry entries in yarn.lock.Frederik Krautwald

1 Answers

0
votes

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 ?