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.
Adding folder structure:
Thanks
You can try other methods to verify if auth toke is right then you can use the per project method as stated in the official documentation . Which says
Access to the Pro packages, which contain more icons and styles, require you to configure the @fortawesome scope to use our Pro NPM registry.
Pro packages are part of the extra services that you get with a Pro subscription. Get access to them, a ton more icons in different styles, other services, and dedicated support.
Global Set Up - Globally set these values so it works in any project:
npm config set "@fortawesome:registry" https://npm.fontawesome.com/ && \\ npm config set "//npm.fontawesome.com/:_authToken" TOKEN
Per-Project - If you'd prefer a per-project setting (great for teams and CI/CD), create a .npmrc file in the root of your project (or where you have your package.json file):
@fortawesome:registry=https://npm.fontawesome.com/ //npm.fontawesome.com/:_authToken=TOKEN
After that configuration, you can install the latest Pro version of Font Awesome via npm or yarn:
npm install --save-dev @fortawesome/fontawesome-pro yarn add --dev @fortawesome/fontawesome-pro
Environment variables - You can also leverage NPM's environment variables replacing:
@fortawesome:registry=https://npm.fontawesome.com/ //npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN} FONTAWESOME_NPM_AUTH_TOKEN=TOKEN npm install --save-dev @fortawesome/fontawesome-pro
Make sure the file is in the root project directory. Here's an issue related to what you're getting . From this
It might help not to mistake a license key for a token :-) Thx.
Changing npm cache
location path also could help you fix it. npm config set cache C:\\Dev\\nodejs\\npm-cache --global
or consider deleting npm cache
.
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 :
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.