Create multiple npm packages with gitlab's Package Registry

I’ve been trying to create several npm packages with the gitlab Package Registry. I followed this documentation npm packages in the Package Registry | GitLab about it.

Describe your question in as much detail as possible:
I’d like to create 2 npm packages to use them in other private projects. I’d like to have those 2 packages in the same sub group such as:

mainGroup
|- subGroup
   |- project1
   |- project2

Plus, I’d like to name them @mainGroup/project1 and @mainGroup/project2

I manage to create the package registry by building the projects and adding the following config to the .npmrc file:

@mainGroup:registry=https://gitlab.my-gitlab.fr/api/v4/projects/<project_id>/packages/npm/

//gitlab.my-gitlab.fr/api/v4/projects/<project_id>/packages/npm/:_authToken=<auth_token>

Then with the publish command I finally had both packages

This is where it gets tricky:

On a third project I created the .npmrc file with :

@mainGroup:registry=https://gitlab.my-gitlab.fr/api/v4/projects/<project1_id>/packages/npm/

//gitlab.my-gitlab.fr/api/v4/projects/<project1_id>/packages/npm/:_authToken=<auth_token>

Then I added the first package with yarn add @mainGroup/project1 : it worked fine

But I can’t add the @mainGroup/project2 package because of the conflict in the .npmrc file

I believe using the instance-level endpoint instead of the project one could be an option, but I’m really having trouble using it… Could someone please help me?