Font-Awesome
Font-Awesome copied to clipboard
Update the documentation on the new .yarnrc.yml format for pro users
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
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/
Another valid configuration (.yarnrc.yml
):
npmScopes:
fortawesome:
npmRegistryServer: "https://npm.fontawesome.com/"
npmAlwaysAuth: true
npmAuthToken: "YOUR-TOKEN"
@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?
Hello, I'm having issues with the above config. Seems the request is redirected to npmjs.org
For posterity, npm gives the same error
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
Well, do I feel like an idiot now 😅
This really should be on the Docs page.
I can confirm
npmScopes:
fortawesome:
npmAlwaysAuth: true
npmAuthToken: "${FONT_AWESOME_AUTH_TOKEN}"
npmRegistryServer: "https://npm.fontawesome.com/"
Also works on yarn 3.2
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.
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.
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/' } }
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/' } }
@tagliala What is wrong with it? Is it yarn issue or fontawesome ?
also having the same issue, with both Yarn 3.x and trying to resolve using NPM
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
Had to install via npmrc
before the yarn version started working. So weird.