SebastianG
SebastianG

Reputation: 9584

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.

Upvotes: 4

Views: 1330

Answers (1)

Mert
Mert

Reputation: 1363

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/

Upvotes: 5

Related Questions