Skip to main content
Code and think

Yarn Berry and npmScopes

Yarn Classic is being pushed out and replaced with yarn berry. In case you migrate from the former to the later and use different registries based on the scope as described in the documentation, you might find a few surprises.

  1. In case your scope starts with an AT sign [@], you should omit it in the .yarnrc.yml file in the npmScopes section. For example, if your package is @my-company/my-package the npmScopes entry will be:
npmScopes:
  my-company:
    npmRegistryServer: https://pkgs.my-company.com/...
  1. In case you are using Azure package registry (e.g. https://pkgs.dev.azure.com) you can authenticate via npmAuthIdent. The value should be a base64 of username:token. An example structure will be:
npmScopes:
  my-company:
    npmAlwaysAuth: true
    npmAuthIdent: $AZURE_NPM_TOKEN
    npmRegistryServer: https://pkgs.dev.azure.com/my-company/my-scope/_packaging/feed/npm/registry/

Where the $AZURE_NPM_TOKEN is <base64(<username:raw PAT>)>.