0

语境

我正在尝试将私有包发布到 AWS CodeArtifact 并且遇到了困难。

package.json文件的private字段设置为false防止意外发布到 npmjs.com 注册表,以防我们团队中的开发人员出错。包发布到 AWS CA 失败并出现预期错误(请参阅下面的响应 1)。

当我指定以下内容时也会发生同样的事情publishConfig(请参阅下面的响应 2)。

{
  "publishConfig": {
    "registry": "https://xxxxx-demo-domain-xxxxxxxxxxxx.d.codeartifact.us-east-1.amazonaws.com/npm/xxxxx-demo-repo/",
    "access": "restricted"
  }
}

问题

如何配置publishConfig以允许将程序包发布到我们团队控制下的特定 AWS CA 域/注册表?我在 AWS 文档、StackOverflow 或其他任何在线网站上都找不到有关它的信息。

回应 1

$ npm publish
npm notice
npm notice   @ec/trivial-package@1.2.0
npm notice === Tarball Contents ===
npm notice 77B  index.js
npm notice 797B package.json
npm notice === Tarball Details ===
npm notice name:          @ec/trivial-package
npm notice version:       1.2.0
npm notice filename:      @ec/trivial-package-1.2.0.tgz
npm notice package size:  541 B
npm notice unpacked size: 874 B
npm notice shasum:        a356f71ca997c48c54cd91172884ae8da9911725
npm notice integrity:     sha512-WSa7fmhfuSXFY[...]Nn9JqgAUaHSeA==
npm notice total files:   2
npm notice
npm ERR! code EPRIVATE
npm ERR! This package has been marked as private
npm ERR! Remove the 'private' field from the package.json to publish it.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\igors\AppData\Local\npm-cache\_logs\2022-01-06T01_47_28_986Z-debug.log

回应 2

$ npm publish
npm notice
npm notice   @ec/trivial-package-2@1.0.0
npm notice === Tarball Contents ===
npm notice 77B  index.js
npm notice 609B package.json
npm notice === Tarball Details ===
npm notice name:          @ec/trivial-package-2
npm notice version:       1.0.0
npm notice filename:      @ec/trivial-package-2-1.0.0.tgz
npm notice package size:  507 B
npm notice unpacked size: 686 B
npm notice shasum:        57511cd858f92a1818621045f34bfd5723649271
npm notice integrity:     sha512-uV5seBJT40fFy[...]BVD355OzLkcBQ==
npm notice total files:   2
npm notice
npm ERR! code EPRIVATE
npm ERR! This package has been marked as private
npm ERR! Remove the 'private' field from the package.json to publish it.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\igors\AppData\Local\npm-cache\_logs\2022-01-06T20_27_04_435Z-debug.log
4

0 回答 0