Having trouble consuming private NPM dependency from github

2.3k Views Asked by At

I am trying to consume a private React NPM package from my own github repo. I have successfully published to my github repo the package.

In the consumer project, I have sucessfully installed the package using the command my github/packages page provided. Command line tells me it has added the package.

I add to App.js:

import { HelloWorld } from '<the-same-package-name/inside-the-package.json>';

When I try to use the actual component, I keep getting the error: Module not found: Error: Can't resolve '@my_github/private-repo' in <my local path>

does anyone have any idea what on earth I am doing wrong? I have the .npmrc set up in the same level as package.json with:

//npm.pkg.github.com/:_authToken=<my auth token with read privileges>
registry=https://npm.pkg.github.com/<my repo>

Is this a problem with exporting components from React? Am I not pulling in the component the correct way?

I have spent over an hour on this and just do not understand what part I am missing.

0

There are 0 best solutions below