Cli: npm publish 404 Not Found - PUT

Created on 7 Aug 2020  ·  3Comments  ·  Source: npm/cli

The nearest issue is #1626 but it's about using npm to get package, and it look solved for most user.
Here it's about npm publishing package in CI, and it's not solved for now.

Current Behavior:

https://framagit.org/1000i100/g1lien/-/jobs/1072053

$ npm publish
[...]
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/g1link - Not found
npm ERR! 404 
npm ERR! 404  '[email protected]' 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.
[...]

Expected Behavior:

Successful publish of my package from docker in gitlab-CI with npm_token authentication.
(it works yesterday on my laptop with npm login, but not with npm_token in CI).

Steps To Reproduce:

ex. steps to reproduce the behavior:

  1. Fork this : https://framagit.org/1000i100/g1lien
  2. change the package name and add your npm token
  3. push it with a tag on a gitlab with CI active.

It should reproduce the problem.

Environment:

https://framagit.org/1000i100/g1lien/-/blob/master/.gitlab-ci.yml#L5
https://framagit.org/1000i100/g1lien/-/jobs/1072052#L17

  • OS: Docker in gitlab with image: node:current
  • Node: v14.7.0
  • NPM: 6.14.7

Most helpful comment

I was trying to npm publish from a new machine and got the same unexpected 404. In my case it was solved by an npm login. I understand that a 401 could "leak" the presence of a private package, but I would think the CLI would first check to see whether I was authenticated first and respond with a more appropriate error.

Here is the relevant portion of the log when I tried to npm publish before npm login:

19 verbose stack Error: 404 Not Found - PUT https://registry.npmjs.org/mock-fs - Not found
19 verbose stack     at /Users/tschaub/.nvm/versions/node/v14.8.0/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
19 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:93:5)
20 verbose statusCode 404
21 verbose pkgid [email protected]
22 verbose cwd /Users/tschaub/projects/mock-fs
23 verbose Darwin 19.6.0
24 verbose argv "/Users/tschaub/.nvm/versions/node/v14.8.0/bin/node" "/Users/tschaub/.nvm/versions/node/v14.8.0/bin/npm" "publish"
25 verbose node v14.8.0
26 verbose npm  v6.14.8
27 error code E404
28 error 404 Not Found - PUT https://registry.npmjs.org/mock-fs - Not found
29 error 404
30 error 404 '[email protected]' is not in the npm registry.
31 error 404 You should bug the author to publish it (or use the name yourself!)
32 error 404 Note that you can also install from a
33 error 404 tarball, folder, http url, or git url.
34 verbose exit [ 1, true ]

All 3 comments

Same error.

Last release 30.07 was successful. But since 11.08 I get this error when publish:
2020-08-13T09:56:54.1669946Z 18 http fetch PUT 404 https://registry.npmjs.org/@aurigma%2fui-framework 5611ms
2020-08-13T09:56:54.1670114Z 19 verbose stack Error: 404 Not Found - PUT https://registry.npmjs.org/@aurigma%2fui-framework - Not found

I was trying to npm publish from a new machine and got the same unexpected 404. In my case it was solved by an npm login. I understand that a 401 could "leak" the presence of a private package, but I would think the CLI would first check to see whether I was authenticated first and respond with a more appropriate error.

Here is the relevant portion of the log when I tried to npm publish before npm login:

19 verbose stack Error: 404 Not Found - PUT https://registry.npmjs.org/mock-fs - Not found
19 verbose stack     at /Users/tschaub/.nvm/versions/node/v14.8.0/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
19 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:93:5)
20 verbose statusCode 404
21 verbose pkgid [email protected]
22 verbose cwd /Users/tschaub/projects/mock-fs
23 verbose Darwin 19.6.0
24 verbose argv "/Users/tschaub/.nvm/versions/node/v14.8.0/bin/node" "/Users/tschaub/.nvm/versions/node/v14.8.0/bin/npm" "publish"
25 verbose node v14.8.0
26 verbose npm  v6.14.8
27 error code E404
28 error 404 Not Found - PUT https://registry.npmjs.org/mock-fs - Not found
29 error 404
30 error 404 '[email protected]' is not in the npm registry.
31 error 404 You should bug the author to publish it (or use the name yourself!)
32 error 404 Note that you can also install from a
33 error 404 tarball, folder, http url, or git url.
34 verbose exit [ 1, true ]

Yeah, npm login helps. A few days ago I discovered this too. But still it is not clear why I had to re-authorize
Npm should improve their error messages.

Was this page helpful?
0 / 5 - 0 ratings