Unable to authenticate with gitlab.com NPM Repo
Summary
Followed these directions: https://docs.gitlab.com/ee/user/project/packages/npm_registry.html https://docs.gitlab.com/ee/api/oauth2.html#resource-owner-password-credentials-flow I'm a GitLab Premium User.
When I try to npm publish or npm adduser
From a node:10 docker container done manually on CLI: root@67afb93dfe57:/project# npm adduser --registry=http://gitlab.com/api/v4/projects/11141074/packages/npm/ npm ERR! code E301 npm ERR! Registry returned 301 for POST on http://gitlab.com/api/v4/projects/11141074/packages/npm/-/v1/login
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-03-12T00_01_51_581Z-debug.log
From the same docker container when I try publish:
npm notice === Tarball Details ===
npm notice name: project
npm notice version: 0.1.0
npm notice package size: 2.5 MB
npm notice unpacked size: 9.5 MB
npm notice shasum: 1fe54432b0c294baee3bd0babc6896951afadbd4
npm notice integrity: sha512-coTCMCI3iFHWw[...]gJ000IPpohskA==
npm notice total files: 1484
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using npm adduser
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-03-11T23_26_27_654Z-debug.log
From my CI Pipeline:
npm notice === Tarball Details ===
npm notice name: package
npm notice version: 0.1.0
npm notice package size: 2.5 MB
npm notice unpacked size: 9.4 MB
npm notice shasum: 79ac1a881467ef4db8bb20534327de0bee421070
npm notice integrity: sha512-CHH9HwO9taPBl[...]/AqPlKNFOMeWw==
npm notice total files: 1486
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using npm adduser
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-03-11T18_37_48_185Z-debug.log
ERROR: Job failed: exit code 1
Steps to reproduce
Followed these directions: https://docs.gitlab.com/ee/user/project/packages/npm_registry.html https://docs.gitlab.com/ee/api/oauth2.html#resource-owner-password-credentials-flow
- npm adduser --registry=http://gitlab.com/api/v4/projects//packages/npm/
- Supposed to take the oauth from .npmrc and use it to set up CI but since adduser didn't work I pulled my oauth with a curl command per: https://docs.gitlab.com/ee/api/oauth2.html#resource-owner-password-credentials-flow
- Add something like this to package.json: "publishConfig": { "@foo:registry": "https://gitlab.com/api/v4/projects//packages/npm/" }
- Set up .npmrc per https://docs.gitlab.com/ee/user/project/packages/npm_registry.html
- npm publish
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
What is the current bug behavior?
Auth fails
What is the expected correct behavior?
(What you should see instead)
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
