Font-awesome: Heroku Build with Pro icons

Created on 24 Dec 2017  Â·  16Comments  Â·  Source: FortAwesome/Font-Awesome

Using my Pro icons in a project I'd like to deploy to heroku. I don't want to have my registry key in my public github project, but I'd still like to deploy to heroku from the public github project. Is there a way to set my registry key as a config variable?

question

Most helpful comment

Hi,

I've successfully tested FA Pro on Heroku with the following approach:

Add .npmrc to your project root:

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

Then you could add an environment variable heroku config:set FONT_AWESOME_AUTH_TOKEN=your_token.

I suggest to use per-project .npmrc, especially if you are using both FA Free and Pro for your projects

All 16 comments

Currently, the only way to do this is with setting an .npmrc file in the project root. I'd love to know if there is a good way to this with npm and Heroku.

I've been trying to use app.json for Heroku Pipeline Review apps and inherit the config variable from my staging and/or production apps but its still not working as expected. Currently I'm getting this error; which seems strang becuase the free icons should need a registry key right?

npm ERR! code E401
npm ERR! 404 401 Unauthorized: @fortawesome/[email protected]

+1
I also get a 401 on the free version as well as on the non free pro version, which I have a token for.

Can you share log files?

Probably, which ones? I did send a piece of the logfile created by npm install in my prev email, that is not what you mean?

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.4.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'i',
1 verbose cli '--save',
1 verbose cli '@fortawesome/fontawesome' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 44d7bf54301f2740
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 401 https://npm.fontawesome.com/TOKEN/@fortawesome%2ffontawesome 668ms
8 silly fetchPackageMetaData error for @fortawesome/fontawesome@latest 401 Unauthorized: @fortawesome/fontawesome@latest
9 verbose stack Error: 401 Unauthorized: @fortawesome/fontawesome@latest

Note: I replaced my token with TOKEN in the text above, the actual token was in the log

On 5 Feb, 2018, at 19:52, Rob Madole notifications@github.com wrote:

Can you share log files?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/FortAwesome/Font-Awesome/issues/11989#issuecomment-363183360, or mute the thread https://github.com/notifications/unsubscribe-auth/AI2BYd4k8AUOfMzKtLrluawRfsb9onpdks5tR03cgaJpZM4RL3j7.

No, there is a detailed log that NPM will generally spit out (by default it does) when something like this occurs. It's a file probably in the root of the directory.

Solved by Rob, it might help not to mistake a license key for a token :-) Thx.

Could someone explain what exactly I have to do to get the icons on heroku? I'm not sure where to start. Thanks!

Hello, im folowing this https://fontawesome.com/how-to-use/use-with-node-js#pro

$ npm config set "@fortawesome:registry" https://npm.fontawesome.com/
$ npm config set "//npm.fontawesome.com/:_authToken" TOKEN

and i get this error

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/home/jlopez/.npm-global/bin/npm',
1 verbose cli 'i',
1 verbose cli '--save',
1 verbose cli '@fortawesome/fontawesome' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 626b0b481e32997c
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 401 https://npm.fontawesome.com/@fortawesome%2ffontawesome 1429ms
8 silly fetchPackageMetaData error for @fortawesome/fontawesome@latest 401 Unauthorized: @fortawesome/fontawesome@latest
9 timing stage:rollbackFailedOptional Completed in 3ms
10 timing stage:runTopLevelLifecycles Completed in 2753ms
11 verbose stack Error: 401 Unauthorized: @fortawesome/fontawesome@latest
11 verbose stack at fetch.then.res (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/fetch.js:42:19)
11 verbose stack at tryCatcher (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
11 verbose stack at Promise._settlePromiseFromHandler (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
11 verbose stack at Promise._settlePromise (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
11 verbose stack at Promise._settlePromise0 (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
11 verbose stack at Promise._settlePromises (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
11 verbose stack at Async._drainQueue (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
11 verbose stack at Async._drainQueues (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
11 verbose stack at Immediate.Async.drainQueues (/home/jlopez/.npm-global/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
11 verbose stack at runCallback (timers.js:810:20)
11 verbose stack at tryOnImmediate (timers.js:768:5)
11 verbose stack at processImmediate [as _immediateCallback] (timers.js:745:5)
12 verbose cwd /home/jlopez/Proyectos/España/tauro-frontend
13 verbose Linux 4.9.0-6-amd64
14 verbose argv "/usr/bin/node" "/home/jlopez/.npm-global/bin/npm" "i" "--save" "@fortawesome/fontawesome"
15 verbose node v8.11.2
16 verbose npm v6.1.0
17 error code E401
18 error 401 Unauthorized: @fortawesome/fontawesome@latest
19 verbose exit [ 1, true ]

Can you help me

@jlopezjuy is your issue related to Heroku?

If it isn't please open this issue in the Font Awesome Pro repo at https://github.com/FortAwesome/Font-Awesome-Pro?

If you don't have access to the above repository, please make sure you have linked your Font Awesome Account to your GitHub account at https://fontawesome.com/account/services

it's been 7 months since the question has been asked, is there a new solution to this?

@andrewlamyw I found that I need .npmrc file in the root of my project because the global setting won't work.
Link: https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers

Going to close this and if there are still issues we can re-open. This shouldn't be an issue any longer.

Hey. IMHO it's a pretty common use-case, and Font-Awesome would deserve it's own Heroky guidelines tutorial. Wouldn't it ?

Just it case it can be useful for someone, we have it working with:

  • Define FONT_AWESOME_AUTH_TOKEN as environment variable with your token
  • Add a heroku_install script (chmod executable):
#!/usr/bin/env sh
set -e
npm config set "@fortawesome:registry" 'https://npm.fontawesome.com/'
npm config set "//npm.fontawesome.com/:_authToken" "$FONT_AWESOME_AUTH_TOKEN"
  • in package.json:
"scripts": {
    "postinstall": "./heroku_install"
  },

Hi,

I've successfully tested FA Pro on Heroku with the following approach:

Add .npmrc to your project root:

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

Then you could add an environment variable heroku config:set FONT_AWESOME_AUTH_TOKEN=your_token.

I suggest to use per-project .npmrc, especially if you are using both FA Free and Pro for your projects

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eschwinm picture Eschwinm  Â·  3Comments

faithdong picture faithdong  Â·  3Comments

brystfire08 picture brystfire08  Â·  3Comments

petermolnar picture petermolnar  Â·  3Comments

jakuuub picture jakuuub  Â·  3Comments