I have created a pipeline, which runs smoothly in almost all projects, where I am using it. Except one. All projects have to excat same permissions. I use node:16.20 for all as image, I have tried node:latest, same result and only on this one project.
echo "//${GITLAB_REGISTRY}:_authToken=${CI_JOB_TOKEN}" > .npmrc
npm publish --registry=https://${GITLAB_REGISTRY} --loglevel warn
.npmrc file
@adito:registry=https://gitlab.MASKED.de/api/v4/projects/1306/packages/npm/
//gitlab.MASKED.de/api/v4/projects/1306/packages/npm/:_authToken=TOKEN
Pipeline output:
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://gitlab.MASKED.de/api/v4/projects/1310/packages/npm
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/2024-12-19T13_42_24_196Z-debug-0.log
Yes, I have (successfully) tried to npm adduser
, but the result of npm publish
has not changed.
--loglevel verbose
has not helped me with more details, why the command fails.
I have double checked twice each and every setting in the project, they were all identical with the other working ones. I am Maintainer of said projects, and I have given Maintainer as well as every permission possible on the PAT.
What am I missing?
Try:
npm publish
Expected:
package registry release
(Yes, I have read though all of the github issue post of the npm github, and I have asked ChatGPT multiple times and tried a lot of missleading answers. It seems normally the issue resolves in the .npmrc file, I have tested multiple variations. Currently working with one working file from another project, just with this projects id.)
Edit: MASKED = the companys name, which I spare the shame!
Edit2: This is fixed, but in the dumbest way possible.
GITLAB_REGISTRY: ${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
I deleted this line, which obviously results in a failed pipeline, let it happen, then added this line in the exact same position as before, and let my pipeline run again, and voila, it worked.
Quirin Joshua Groszeibl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1