You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Verdaccio私有库e-biz-znnf包已发布版本标记未发布问题问询

已发布npm包版本被标记为未发布的原因及触发场景

问题重现

执行命令:

npm view e-biz-znnf versions --json

返回E404错误:

npm ERR! code E404
npm ERR! 404 Unpublished by undefined on 2022-08-08T09:20:35.527Z
npm ERR! 404
npm ERR! 404 'e-biz-znnf' 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.
{
"error": {
"code": "E404",
"summary": "Unpublished by undefined on 2022-08-08T09:20:35.527Z",
"detail": "\n 'e-biz-znnf' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
}
}

排查发现,私有Verdaccio服务器中该包的元数据里,time节点存在unpublished字段,标记1.1.26-alpha.0版本为下架状态,但该版本的tarball文件仍在服务器上,且版本实际发布时间(2022-08-08T09:18:20.123Z)早于下架标记时间(2022-08-08T09:20:35.527Z)。删除unpublished节点后,npm view命令恢复正常。

触发该情况的可能场景

  • 执行npm unpublish后文件未彻底删除:有人执行过npm unpublish e-biz-znnf@1.1.26-alpha.0,Verdaccio更新元数据添加了unpublished标记,但因网络中断、服务器异常等原因,对应版本的tarball文件没被删掉,导致元数据和实际文件状态不一致。
  • Verdaccio版本bug:旧版Verdaccio处理unpublish操作时存在逻辑缺陷,比如只标记下架却没清理文件,或者后续发布新版本时未正确处理历史下架标记。
  • 手动修改元数据出错:如果有人直接编辑过Verdaccio存储的包元数据JSON文件,误添加了unpublished字段,也会引发这个问题。
  • 权限配置异常:用户有包的下架权限,但执行unpublish时没有足够权限删除文件,导致元数据标记下架但文件残留。

为什么会触发E404错误

npm执行view命令时,会优先读取包元数据中的unpublished字段。只要该字段存在且包含对应版本,npm就会判定包(或该版本)已不存在,直接返回404错误——哪怕服务器上实际还存着该版本的文件,这是npm遵循的registry规范,Verdaccio作为私有registry也会适配这个逻辑。

内容的提问来源于stack exchange,提问作者Chen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 23:03:07