Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fontawesome license throwing error while installing using npm

As per fontawesome's documentation I am trying to install pro version of fontawesome 5. I have created a .npmrc file where licence and registry have been mentioned.

Now I am trying to run npm install --save-dev @fortawesome/fontawesome-pro. It is throwing error Bearer token value is not a legal HTTP header value. I have attached a snapshot for the same. Error Snapshot

Adding folder structure:

enter image description here

Thanks

like image 862
Ankur Avatar asked Nov 17 '22 05:11

Ankur


1 Answers

The message can be a bit misleading. This error can occur if your token is very old (I've had this happen a few times myself)

Try to regenerate your _auth_token from the fontawesome page:

enter image description here

If you don't mind a global token (if you do not work with several licenses), you can enable the Pro license globally like so:

#: npm config set "@fortawesome:registry" https://npm.fontawesome.com/

#: npm config set "//npm.fontawesome.com/:_authToken" TOKEN_GOES_HERE

If you work with for instance docker containers, a better solution is to set environment variables like so:

#: FONTAWESOME_NPM_AUTH_TOKEN=YOUR_TOKEN_GOES_HERE npm install --save @fortawesome/fontawesome-pro

or set the .npmrc file with:

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

But try to regenerate the token and re-run your commands.

like image 158
Ole Aldric Avatar answered Dec 08 '22 23:12

Ole Aldric