Nilson Jacques
A full-stack developer from Bristol, UK
One of the problems I faced recently trying out Yarn 2, was configuring it to authenticate a private repository. The project uses Font Awesome Pro, which requires you to configure their repo in your .npmrc
file and provide an auth token.
Yarn 2 no longer reads the .npmrc
file, and private registries have to be configured in the project's .yarnrc.yml
file instead.
It took me a little playing around and squinting at the docs in order to get the right config settings, so I'm posting them here in case they're helpful to someone else.
npmRegistries:
//npm.fontawesome.com:
npmAlwaysAuth: true
npmAuthToken: "YOUR-TOKEN"
npmScopes:
fortawesome:
"https://npm.fontawesome.com"
To break down the settings here:
@fontawesome
but as per the Yarn docs we drop the @
symbol as it's not valid here. Hopefully this might help someone out.