'Why is npm publish telling me the package doesn't exist?
I'm trying to upload an npm package to a GitLab registry for the first time. I set the scope and the npm config entries according to the documentation, but when I execute npm publish
, I get the following error:
npm notice Publishing to https://git.myorg.com/api/v4/projects/123/packages/npm/
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://git.myorg.com/api/v4/projects/123/packages/npm/@myscope%2fmyproject
npm ERR! 404
npm ERR! 404 '@myscope/[email protected]' is not in this 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.
So I try to publish it, and the error says it doesn't exist and that I should publish it...what?!
From the last two lines it looks like the error is meant for an installation failure, but I have definitely used npm publish
. Also, in the PUT
command, the final slash between scope and project name is replaced with %2f
. No idea why that happened and why it happened nowhere else, but maybe that is a symptom of the underlying issue?
Solution 1:[1]
Ok, it was my own fault. When executing npm config set @foo:registry https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/npm/
, I put in the group ID instead of the project ID in the place of <your_project_id>
. We use the group only for the package registry project, so I got them confused.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |