openupm-cli
openupm-cli copied to clipboard
Installation of Scoped Registry for Gitlab Projects fails
Gitlab while not allowing searching of packages does allow hosting of packages at least on project level under a path like:
gitlabHost/api/v4/projects/projectID/packages/npm/
I tried to set up such a scoped registry using openupm-cli:
npx openupm-cli --no-upstream -v -r https://redactedURL/api/v4/projects/39/packages/npm/ add redactedPackageName
however openupm does not try to authenticate and then just shows the package as 404:
verb request no auth needed
SNIP
ERR! 404 package not found:
I haven't looked into the code and it might be that openupm-cli just tries to search for the package first, which fails because gitlab does not support searching for packages.
Adding the package manually into manifest.json and setting up the scoped registry manually works fine.
I should also add that installing the package via npm into any directory also works fine.
Hi @Blackclaws,
Thanks for reporting the issue. I'm not a GitLab user, so could you provide a public testable URL (from you or others), so I can test it?
I'll see what I can do. The non self-hosted instance only supports scoped packages which upm does not accept anyway. I'll get back to you on that.
I've debugged this a bit more. It turned out to actually be an issue of how the --registry flag is parsed vs how its written in the .upmconfig
The registry command line option strips off the final / in the path because its added back in. When looking for auth entries it will not match an entry that has a final slash set as it was in my .upmconfig
This is a bit nontrivial to debug, one possible solution is to apply the same stripping logic to the urls retrieved from the .upmconfig.
If you'd like I'll submit a pull request, this is a general issue with registries that are defined with authentication including a final slash in .upmconfig
This is a bit nontrivial to debug, one possible solution is to apply the same stripping logic to the urls retrieved from the .upmconfig.
Oh, that's a good catch.
If you'd like I'll submit a pull request, this is a general issue with registries that are defined with authentication including a final slash in .upmconfig
It seems a good solution. PR is welcome.
@all-contributors please add @Blackclaws for bug.