2

I am attempting to install Font Awesome Pro in my NextJS app, which is deployed via Vercel. However, I keep getting this error:

error An unexpected error occurred: "https://npm.fontawesome.com/@fortawesome/pro-light-svg-icons/-/5.15.4/pro-light-svg-icons-5.15.4.tgz: Request failed \"401 Unauthorized\""

Then the build exits with Error: Command "yarn install" exited with 1

Locally everything works great. I have the following in my .npmrc file:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=NPM_RC

And then within Vercel settings I have an environmental variable with the name NPM_RC and the value is my personal Pro-Token.

As an aside: I tried doing a global setup using my token but that returns the same error mentioned above. When I reached out to Font Awesome they said that Global setups can be hit or miss and that I should try the .npmrc route.

I reached out to Font Awesome after giving the .npmrc route and try and still having the error. They are not sure what is going on... I am stuck and any help would be greatly appreciated. Cheers!

Isaac Tait
  • 533
  • 5
  • 12
  • is it because you have @fortawesome instead of @fontawesome? – Lazar Nikolic Jan 11 '22 at 14:18
  • FYI - https://github.com/FortAwesome/react-fontawesome/issues/463 – Isaac Tait Jan 11 '22 at 14:41
  • @LazarNikolic It is odd that they did that (fort awesome -- font awesome) I have wondered if it was an early typo they never fixed and it stuck or if they are planning on adding more services like Font Awesome to their fort.... ‍♂️ The docs do say that "fortawesome" is correct though Good eye https://fontawesome.com/v5.15/how-to-use/on-the-web/setup/using-package-managers – Isaac Tait Jan 11 '22 at 14:43

1 Answers1

3

I needed to update my .npmrc file with the following:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=${NPM_RC} 

Thank you @robmadole!

Isaac Tait
  • 533
  • 5
  • 12
  • 1
    The solution had one issue - I kept getting the error: `error An unexpected error occurred: "Failed to replace env in config: ${NPM_RC}".` when running `yarn` commands. I read this article https://stackoverflow.com/questions/52015748/npm-failed-to-replace-env-in-config-npm-token and my solution was to remove {} from the NPM_RC... – Isaac Tait Jan 27 '22 at 14:37