Installing packages with the same scope from npm and GitHub Packages in the same project #57915
Replies: 3 comments 1 reply
-
Its late, but we were in a similar situation and we have a solution (not too pretty, but effective). In our release pipeline we simply push to both our npm and private github registries. That way we can continue using the private repo in our org scope but still getting the same public package. |
Beta Was this translation helpful? Give feedback.
-
@filiptammergard , would it be possible to try something like this in your ./npmrc file:
|
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hey!
Problem
We want to use GitHub Packages to publish and install private npm packages. Meanwhile, we want to publish and install our public npm package from the public npm registry.
We have an npm org and our public npm packages are all scoped as
@org/package
. It seems like a limitation with GitHub Packages is that we need to use the scope of the GitHub organization as@org/package
.This means the formats are the same. When installing a package from GitHub Packages, you need to configure an
.npmrc
file to make all packages with theorg
scope being downloaded from GitHub Packages.I.e:
@org:registry=https://npm.pkg.github.com
Let's say I have one public package
@org/public-package
hosted on npmjs.com, and a private package@org/private-package
hosted on GitHub Packages.Then I can't download them in the same project.
Suggestion
I'd suggest making it possible to use another scope for GitHub Packages, like suggested in https://github.com/orgs/community/discussions/40865.
Alternatives
The alternative for us would be to change the scope/naming structure of our public npm packages, but we really can't do that – it would not make sense to not use
@org/package
structure for the packages that are actually visible and available for anyone to install.Beta Was this translation helpful? Give feedback.
All reactions