Reputation: 129
I am using Azure DevOps for my node application, but I have private npm packages that fail with a 401 whenever DevOps runs the npm install
during the pipeline. I have run the additional npm task runner for authenticating where the Registry URL is set to https://npm.pkg.github.com/ along with the Username and Password for the npm account. Finally, I have created a .npmrc file locally within the project that contains @[organisation_name_here]:registry=https://npm.pkg.github.com/
. However, when I still run the pipeline I still receive the following error:
npm ERR! 401 Unauthorized: @***/schemas@^1.0.8
I have seen and read about the ability to use Azure Artifacts, however, I would prefer not to avoid using them as I am slowly migrating over to AWS. If Azure Artifacts is the only way, then please help! I'm slowly going insane XD lol
Thanks :)
Upvotes: 1
Views: 3260
Reputation: 31003
If your .npmrc
contains Azure Artifacts registries from a different organization or use a third-party authenticated package repository, you'll need to set up npm service connections and specify them in the customEndpoint
input.
registry=https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}/npm/registry/
@{scope}:registry=https://pkgs.dev.azure.com/{otherorganization}/_packaging/{feed}/npm/registry/
@{otherscope}:registry=https://{thirdPartyRepository}/npm/registry/
always-auth=true
Check more details here: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/package/npm-authenticate?view=azure-devops
Upvotes: 3