2

I've been trawling documentation on Netlify's site for how to deploy a node application (specifically a Vue application) which has a private npm repository as a dependency.

I have an .npmrc file setup as follows:

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@my:registry=https://npm.pkg.github.com

I also set the GITHUB_TOKEN variable in my build process's environment variables to the correct value.

However, the build fails.

There is an outline of how to achieve a successful build with a private Github package repository here: https://docs.netlify.com/configure-builds/repo-permissions-linking/#npm-packages.

However, it's still unclear as to what I need to do specifically to both my package.json file and also how to configure the build process' environment variables ...

Could anyone show me a full working example which doesn't leave me scratching my head?

Do I add:

"package-name": "git+https://<github_token>:x-oauth-basic@github.com/<user>/<repo>.git"

to the dependencies section of the package.json?

If yes, how do I then hide my <github_token> and provide the build process with this in Netlify?

How do I also get the same process working locally?

Why can't Netlify just inject the GITHUB_TOKEN into my .npmrc file so I have parity with my local development environment?

Micheal J. Roberts
  • 3,735
  • 4
  • 37
  • 76

0 Answers0