A Heroku buildpack for overriding the .npmrc file in the build directory with the contents of a config var. Necessary for authorizing with npm when installing private packages.
- Open https://github.com/settings/tokens/new
- Create a Github Personal Access token with the following scopes:
repo,write:packagesandread:packages - Run
heroku config:set API_CLIENT_GITHUB_AUTH_TOKEN=token, replacingtokenwith the token you created on step 2 - Add the buildpack to your Heroku app either using the CLI or the Heroku dashboard. The
heroku-buildpack-npmrcneeds to run before any buildpack using npm. In the following example, it runs before theheroku/nodejsbuildpack.
$ heroku buildpacks:set --index 1 https://github.com/mindfulchefuk/heroku-buildpack-npmrc.git
$ heroku buildpacks:add heroku/nodejs