Skip to content

Instantly share code, notes, and snippets.

@yardensk
Last active May 24, 2017 11:12
Show Gist options
  • Save yardensk/58b9d821d225544f0410d3a327db8cb2 to your computer and use it in GitHub Desktop.
Save yardensk/58b9d821d225544f0410d3a327db8cb2 to your computer and use it in GitHub Desktop.
Heroku Node Deployment Issues

Heroku Node Deployment Issues

PROBLEM

You want to use a private NPM package (probably under @funfunfunco domain)

SOLUTION

Heroku needs access to the NPM domain, and this is done using NPM TOKEN.

  1. Go to your Heroku app and add new ENV variable: NPM_TOKEN=7ff9af33-a68e-45fe-b675-c6a98a20d733
  2. Create heroku_prebuild.sh in the same folder where package.json is and write to it: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
  3. Go to package.json and make it something like this:
{
  ...
  "scripts": {
    "heroku-prebuild" : "./heroku-prebuild.sh",
    ...
  },
  ...
  1. Give it a exe permission chmod -x heroku-prebuild.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment