How to get FontAwesome Pro to work with Vercel deployment

ven profile picture

ven • published on 2021-01-041 min read

Whilst making this website, I opted to use FontAwesome's icons as they have such an expansive library available.

On top of that, I decided to use their Pro library, however once deploying, the build would fail with Vercel due to a lack of permissions to install the required packages.

Solution

The simplest way to resolve this is to create a .npmrc file at the root of your Next.js application, like so:

.npmrc
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=YOUR_FONTAWESOME_TOKEN_HERE
  • You can find your token here.
  • Make sure this file isn't pushed to a public repository, as it has a confidential token.

Alternatively, you can create an environment variable on your Vercel project named NPM_RC with the same content as above.

🎉 After this, deploy your application to Vercel and the required Pro packages will be resolvable!