Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use github package registry only for our scoped packages, get the rest from standard npm?

We're trying to use the Github Package Registry to publish our private org packages and they work/that bit is fine.

However, when we try to install them/use throughout our projects from the github registry alongside other scoped npm modules that are on the official npm registry, it will throw out something like:

error Couldn't find package "@azure/identity" on the "npm" registry.

I would have assumed this is not the desired behaviour as I can't imagine you'd want people to use github package registry without npm as an upstream in an 'A or B' kind of scenario. It is pointless not to be able to use dependenceis from NPM and GPR alongside each other.

My npmrc/yarnrc:

registry=https://npm.pkg.github.com/ORG_NAME

OR

registry=https://npm.pkg.github.com/

Verbose output reveals that it is indeed trying to get it from github.

  • Is there a correct configuration to be able to use GPR alongside NPM?
  • Is what I'm trying to do simply not possible with GPR and should I simply stick with NPM?
like image 412
SebastianG Avatar asked Sep 06 '25 03:09

SebastianG


1 Answers

You can define in your .npmrc file on which scope which repository should npm use.

@myscope:registry=https://npm.pkg.github.com

and for everything else

registry=https://registry.npmjs.org/

your .npmrc file should then look something like this:

@myscope:registry=https://npm.pkg.github.com
registry=https://registry.npmjs.org/
like image 99
Mert Avatar answered Sep 09 '25 07:09

Mert