I’m trying to install a package from a private Azure DevOps registry using Yarn. I have configured my .yarnrc.yml file as follows:
npmRegistryServer: https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
npmAuthToken: <my-auth-token>
<code>npmScopes:
mycompany:
npmRegistryServer: https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
npmAlwaysAuth: true
npmAuthToken: <my-auth-token>
</code>
npmScopes:
mycompany:
npmRegistryServer: https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
npmAlwaysAuth: true
npmAuthToken: <my-auth-token>
When I try to add the package with:
yarn add @mycompany/mypackage
I receive the following errors:
<code>➤ YN0027: @mycompany/mypackage@unknown can't be resolved to a satisfying range
➤ YN0041: Invalid authentication (as an unknown user)
➤ Errors happened when preparing the environment required to run this command.
<code>➤ YN0027: @mycompany/mypackage@unknown can't be resolved to a satisfying range
➤ YN0041: Invalid authentication (as an unknown user)
➤ Errors happened when preparing the environment required to run this command.
</code>
➤ YN0027: @mycompany/mypackage@unknown can't be resolved to a satisfying range
➤ YN0041: Invalid authentication (as an unknown user)
➤ Errors happened when preparing the environment required to run this command.
The setup works fine with npm using the following .npmrc configuration:
<code>registry=https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:email=[EMAIL]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:email=[EMAIL]
<code>registry=https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
always-auth=true
; begin auth token
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:email=[EMAIL]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:email=[EMAIL]
; end auth token
</code>
registry=https://pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/
always-auth=true
; begin auth token
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/registry/:email=[EMAIL]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:username=mycompany
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:_password=[ACCESS_TOKEN]
//pkgs.dev.azure.com/mycompany/_packaging/myproject/npm/:email=[EMAIL]
; end auth token
yarn version 3.6.4
npm version 10.8.1
node version 18.20.3
Verified the Package Name: I checked that the package @mycompany/mypackage exists in the registry.
Checked Authentication Token: Confirmed that the npmAuthToken is correct and has the necessary permissions.
Manual Configuration: Tried setting the registry and authentication token manually with the following commands: