Multiple scope support for Github NPM package management

We are running into an issue where we have repositories that publish to multiple npm private scopes within a single organization (i.e. @scope1 @otherscope). Github NPM registry appears to prevent us from publishing to the registry and returns the following error:

npm ERR! 400 Bad Request - PUT - scope `otherscope` in package name `@otherscope/npm-test` does not match repo owner `my-org` in repository element in package.json

Previously with our private npm registry we have had no issue with having multiple scopes in the same registry. As per the npm documentation this is also stated as possible 

Any idea how we can overcome this limitation? In the context of mono repos and other workflows it becomes difficult to maintain unique names for packages for an entire organization hence the utilization of scopes as an effective mechanism. 

1 Like

@rdbenoit ,

According to the descriptions from the docs about npm, the packages seem need to be named with the format of @owner/name. The  owner is the name of the user or organization account that owns the repository containing your project. 

Configuring npm for use with GitHub Packages


I did not find any ways can allow us to changes the package name without that format.

So to clarify do we know if this is possible:

We have a github organization called “myorg1” and that organization has a few different owners (owner1, owner2).

Is the github packages setup for the owner(s) or the organization? Or is the github packages setup for the organization itself (myorg1)?

If it is based on owners would we then be able to publish to different scopes/owners (i.e. some packages would be published under scope owner1 others could be published under owner2)

@rdbenoit ,

I think, if the repository of the package is hosted on an organization account, the package name should be the format  @organization/name , such as @myorg1/pkgname in your case. And if the repository of the package is hosted on an user account, the package name should be the format  @user/name , such as @owner1/pkgname , @owner2/pkgname  in your case.

This doesn’t make any sense to me!
Consider a company MyOrg with multiple projects ProjA and ProjB.
Each project is built with multiple packages, scoped to each project, like @ProjA/Pack1 and @ProjB/Pack1.
Packages of one project isn’t mean to be used on another project.
Having to use @MyOrg/Pack1 would defeat the purpose of scoped packages, especially in private organizations.