Font-Awesome icon indicating copy to clipboard operation
Font-Awesome copied to clipboard

Update the documentation on the new .yarnrc.yml format for pro users

Open thelfensdrfer opened this issue 5 years ago • 9 comments

Describe the bug For yarn 2 there is a new config format, .yarnrc.yml (https://next.yarnpkg.com/configuration/yarnrc),

To Reproduce Install yarn 2.

Expected behavior Include what you have to insert in your config file in the docs.

Bug report checklist

  • [x] I have filled out as much of the above information as I can
  • [ ] I have included a test case because my odds go way up that the team can fix this when I do
  • [x] I have searched for existing issues and to the best of my knowledge this is not a duplicate

thelfensdrfer avatar Feb 06 '20 11:02 thelfensdrfer

I got stuck on the scope name since it has an @ sign in it. After searching around I found out that you can just drop it from the scope name. Here is what I added to my .yarnrc.yml to get it to authenticate properly:

npmRegistries:
  //npm.fontawesome.com:
    npmAlwaysAuth: true
    npmAuthToken: "YOUR-TOKEN"

npmScopes:
  fortawesome:
    npmRegistryServer: https://npm.fontawesome.com/

shawnheide avatar Apr 06 '20 21:04 shawnheide

Another valid configuration (.yarnrc.yml):

npmScopes:
  fortawesome:
    npmRegistryServer: "https://npm.fontawesome.com/"
    npmAlwaysAuth: true
    npmAuthToken: "YOUR-TOKEN"

PutziSan avatar Sep 10 '20 12:09 PutziSan

@shawnheide @PutziSan thanks for the heads-up

Quoting from: https://next.yarnpkg.com/configuration/yarnrc

Environment variables can be accessed from setting definitions by using the ${NAME} syntax when defining the values. By default Yarn will require the variables to be present, but this can be turned off by using either ${NAME-fallback} (which will return fallback if NAME isn't set) or ${NAME:-fallback} (which will return fallback if NAME isn't set, or is an empty string).

Did anyone test with an environment variable instead of hard-coding the token in the configuration?

tagliala avatar Sep 10 '20 15:09 tagliala

Hello, I'm having issues with the above config. Seems the request is redirected to npmjs.org

image

seebeen avatar Sep 15 '21 08:09 seebeen

For posterity, npm gives the same error

image

seebeen avatar Sep 15 '21 08:09 seebeen

Hi, there is a typo in the package name (foRtawesome-pro)

scope: @fortawesome package name: fontawesome-pro full: @fortawesome/fontawesome-pro

foRtawesome in the scope is not a typo 😅

PS: I've just tried

$ yarn add @fortawesome/fontawesome-pro

with the following .yarnrc.yml:

npmScopes:
  fortawesome:
    npmRegistryServer: "https://npm.fontawesome.com/"
    npmAlwaysAuth: true
    npmAuthToken: ${FONT_AWESOME_AUTH_TOKEN}

So I can confirm that yarn@berry v2.4.3 fetches the token from the environment

Without a fallback, the above configuration throws an error if the token is not found, so it will be easy to debug

@robmadole I think that is safe to add the above snippet to the instructions for Yarn 2

tagliala avatar Sep 15 '21 09:09 tagliala

Well, do I feel like an idiot now 😅

seebeen avatar Sep 19 '21 07:09 seebeen

This really should be on the Docs page.

tyteen4a03 avatar Jul 24 '22 03:07 tyteen4a03

I can confirm

npmScopes:
  fortawesome:
    npmAlwaysAuth: true
    npmAuthToken: "${FONT_AWESOME_AUTH_TOKEN}"
    npmRegistryServer: "https://npm.fontawesome.com/"

Also works on yarn 3.2

tagliala avatar Jul 24 '22 07:07 tagliala

Having trouble authenticating.. where are you setting your environment variable?

yarn add @fortawesome/fontawesome-pro  
➤ YN0027: @fortawesome/fontawesome-pro@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.

SaavanNanavati avatar May 02 '23 21:05 SaavanNanavati

Hi I use yarn v3.5.1 This is my .yarnrc.yml file:

nodeLinker: node-modules

npmScopes:
  fortawesome:
    npmAlwaysAuth: true
    npmAuthToken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    npmRegistryServer: "https://npm.fontawesome.com/"

yarnPath: .yarn/releases/yarn-3.5.1.cjs

I fill npmAuthToken with my token.

but when I want to install @fortawesome/fontawesome-pro I get below error:


yarn add @fortawesome/fontawesome-pro
➤ YN0027: @fortawesome/fontawesome-pro@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.

EhsanKhalili avatar May 13 '23 07:05 EhsanKhalili

Can you please try yarn config --why in the folder where you are executing yarn and check if npmScopes looks correct?

You should see something like

➤ YN0000: npmScopes                     undefined, ~/fa5pro/.yarnrc.yml   Map(1) { 'fortawesome' => Map(6) { 'npmAlwaysAuth' => true, 'npmAuthIdent' => null, 'npmAuthToken' => '********', 'npmAuditRegistry' => null, 'npmPublishRegistry' => null, 'npmRegistryServer' => 'https://npm.fontawesome.com/' } }

tagliala avatar May 13 '23 08:05 tagliala

Here is my npmScopes :

YN0000: npmScopes                     undefined, /E:/Khalili/Private/Projects/Mountain/PAK/.yarnrc.yml   Map(1) { 'fortawesome' => Map(6) { 'npmAlwaysAuth' => true, 'npmAuthIdent' => null, 'npmAuthToken' => '********', 'npmAuditRegistry' => null, 'npmPublishRegistry' => null, 'npmRegistryServer' => 'https://npm.fontawesome.com/' } }

EhsanKhalili avatar May 13 '23 08:05 EhsanKhalili

Screenshot 2023-05-14 at 2 42 13 AM image

@tagliala What is wrong with it? Is it yarn issue or fontawesome ?

EhsanKhalili avatar May 13 '23 23:05 EhsanKhalili

also having the same issue, with both Yarn 3.x and trying to resolve using NPM

lorenyeung avatar May 30 '23 22:05 lorenyeung

I had the same issue, yarn version 3.6.1 Leaving note for everyone who is facing similar issue and stumbled upon this ticket

for me hardcoding npmAuthToken haven't worked however somehow using environment variable worked "${FONT_AWESOME_AUTH_TOKEN}" so there is some problem with with yarn config itself

Then i decided to follow yarn instruction here and adjusted values accordingly by running following commands

yarn config set initScope npmScopes
yarn config set npmScopes.fortawesome.npmRegistryServer https://npm.fontawesome.com/
yarn config set npmScopes.fortawesome.npmAlwaysAuth true
yarn config set npmScopes.fortawesome.npmAuthToken XXXXX-XXX....

This updated yarn config similar to provided in documentation with exception of one more extra line

initScope: npmScopes

Somehow this line was critical to make it work with hardcoded token

IdeaHunter avatar Jul 13 '23 13:07 IdeaHunter

Had to install via npmrc before the yarn version started working. So weird.

cozzbie avatar Jul 31 '23 13:07 cozzbie