Skip to content

Missing slash in 'Registry setup' section of NPM Module in GitLab Registry

Summary

When viewing an NPM package in the GitLab NPM Registry, there is a section at the bottom captioned 'Registry setup'. It contains a command to configure npm to use the GitLab Registry:

echo @foo:registry=https://gitlab.com/api/v4/packages/npm >> .npmrc

Proceeding with this command resulted in a 403 when trying to npm install a module from the GitLab Registry. The issue goes away, when adding a slash to the URL. That is also the way it is documented here: https://gitlab.com/help/user/packages/npm_registry/index#authenticating-with-a-personal-access-token-or-deploy-token

Concluding, I think the command above should contain a slash, like this:

echo @foo:registry=https://gitlab.com/api/v4/packages/npm/ >> .npmrc

Steps to reproduce

  • Publish a NPM package in the GitLab Registry
  • Go to 'Packages & Registries' > {New Package}
  • Execute the 'npm command' in the 'Registry setup' section
  • Try to npm install your new package
  • Receive 403 – Forbidden
  • Add slash to URL in .npmrc
  • Should work now

What is the current bug behavior?

Missing slash at the end of the GitLab Registry URL.

What is the expected correct behavior?

See above.

Relevant logs and/or screenshots

image