Npm publish to private gitlab instance results in 404

Describe your question in as much detail as possible:
I try to publish a npm package to private gitlab CE instance. I followed the gitlab guide on how to setup npm and my project (npm packages in the Package Registry | GitLab).
I try to publish to the project level endpoint.However, I always get a 404. I cannot see anything special in the gitlab logs but the 404 error.

To publish, I use CI_JOB_TOKEN=<deploy-token> npm publish --verbose

  • What are you seeing, and how does that differ from what you expect to see?
    I get a 404, I expect a 200 (or similar success code):
npm notice === Tarball Details === 
npm notice name:          @kbb-internal/budgetmodul-client-test   
npm notice version:       1.0.0                                   
npm notice package size:  13.7 MB                                 
npm notice unpacked size: 75.1 MB                                 
npm notice shasum:        8c57150f3220233ac40f8ca24ebb9ecbdd68ae0a
npm notice integrity:     sha512-RZaEKVWEll2oj[...]CAPyREalN5HTQ==
npm notice total files:   12964                                   
npm notice 
npm http fetch PUT 404 https://git.kbb.eu/api/v4/projects/17/packages/npm/@kbb-internal%2fbudgetmodul-client-test 17199ms
npm verb stack Error: 404 Not Found - PUT https://git.kbb.eu/api/v4/projects/17/packages/npm/@kbb-internal%2fbudgetmodul-client-test
npm verb stack     at /home/eddy/.nvm/versions/node/v14.19.1/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
npm verb stack     at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm verb statusCode 404
npm verb pkgid @kbb-internal/budgetmodul-client-test@1.0.0
npm verb cwd /home/eddy/projects/kbb/budgetmodul-client-test
npm verb Linux 5.13.0-37-generic
npm verb argv "/home/eddy/.nvm/versions/node/v14.19.1/bin/node" "/home/eddy/.nvm/versions/node/v14.19.1/bin/npm" "publish" "--verbose"
npm verb node v14.19.1
npm verb npm  v6.14.16
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://git.kbb.eu/api/v4/projects/17/packages/npm/@kbb-internal%2fbudgetmodul-client-test
npm ERR! 404 
npm ERR! 404  '@kbb-internal/budgetmodul-client-test@1.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm verb exit [ 1, true ]
npm timing npm Completed in 25967ms
  • Consider including screenshots, error messages, and/or other helpful visuals

  • What version are you on? Are you using self-managed or GitLab.com?

    • GitLab (Hint: /help): Gitlab CE 14.5.2
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)
    .npmrc

@kbb-internal:registry=https://<gitlab-url>/api/v4/projects/17/packages/npm/
//git.kbb.eu/api/v4/projects/17/packages/npm/:_authToken=${CI_JOB_TOKEN}

strict-ssl = false

package.json

{
  "name": "@kbb-internal/budgetmodul-client-test",
  "version": "1.0.0",
  "description": "",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "scripts": {
    "build": "tsc"
  },
  "dependencies": {
    "axios": "^0.26.1",
    "class-transformer": "^0.4.0",
    "class-validator": "^0.13.2"
  },
  "devDependencies": {
    "typescript": "~3.5.2",
    "@types/validator": "^13.7.1",
    "rimraf": "^3.0.2"
  },
  "publishConfig": {
    "@kbb-internal:registry": "https://git.kbb.eu/api/v4/projects/17/packages/npm/"
  }
}

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
  • I checked if there is an nginx in front of the gitlab nginx ->no
  • I rechecked the config multiple times
  • I used a personal Access token instead of a deploy token
  • I tried the whole procedure via gitlab-ci → without success, same error.

Hi @eddykaya

Did you sort this out in the end? I’ve been having issues with npm publish also…

It seems that this is a misleading error message
there’s still a problem with the authentication…