Closed hunterloftis closed 4 years ago
+1
+1
I have problems how setup credentials for npm private registry without add credentials into git repository.
@abtris
You'll want to commit an .npmrc
file to your repo that loads your token from environment variables. Here is the example .npmrc
@myregistry:registry=http://myregistry.com:8080/
//myregistry.com:8080/:_authToken=${NPM_TOKEN}
Then just set your environment variable...
$ heroku config:set NPM_TOKEN=<your token>
You folks are awesome. Thanks @kevinohara80!
Note that this solution makes local development inconvenient. see https://github.com/heroku/heroku-buildpack-nodejs/issues/363 for more details.
The following article with the matching buildpacks seem relevant: http://zeke.sikelianos.com/npm-and-github-automation-with-heroku/
In the end it didn't work with zeke's buildpack, but I did get it working with the one from Tim Shadel: https://github.com/timshadel/heroku-buildpack-github-netrc
This way you use 2 buildpacks (I'm not sure if order matters), heroku-buildpack-github-netrc
and the official heroku/nodejs
buildpack and, you set the GITHUB_AUTH_TOKEN
environment variable and then dependencies from github just work. Even the regular github:<githubname>/<githubrepo>[#<commit-ish>]
syntax.
Would be awesome to get this included by default in the offical heroku/nodejs
. This one of the most painful things I had to deal with in regards to Heroku.
(in all the forms - private npm repo, private github / bitbucket repo...)