首页 > 解决方案 > Npm 发布在 GCP 中返回写入 EPIPE 错误

问题描述

我正在尝试将 NodeJS 包发布到 GCP 中的私有存储库,使用此快速入门配置 .npmrc 文件和身份验证:https ://cloud.google.com/artifact-registry/docs/nodejs/quickstart ,当我尝试通过命令行发布它会返回错误:

verbose stack FetchError: request to https://myurl-gcp/myproject/myrepo/@scope%2fmypackage failed, reason: write EPIPE
verbose stack     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:110:14)
verbose stack     at ClientRequest.emit (node:events:378:20)
verbose stack     at TLSSocket.socketErrorListener (node:_http_client:462:9)
verbose stack     at TLSSocket.emit (node:events:378:20)
verbose stack     at emitErrorNT (node:internal/streams/destroy:188:8)
verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
verbose stack     at processTicksAndRejections (node:internal/process/task_queues:81:21)

如果我尝试打包项目它可以工作,并且如果我在另一个项目中使用它作为导入模块它也可以工作。

版本 NPM:7.20.5 版本节点:15.11.0

任何疑问为什么会发生?

标签: npmgoogle-cloud-platformrepositorypublishartifact

解决方案


解决!

我错过了包裹files中的财产。package.json

我也遇到了问题,因为我使用的是公司代理并且包有大约 20 MB,所以也删除了它工作的捆绑依赖项!


推荐阅读