Publishing npm private package to AWS CodeArtifact (private field set to true in package.json)

0

Context

I am attempting to publish a private package to AWS CodeArtifact and having difficulties.

The package.json file has its private field set to false to prevent accidental publishing to npmjs.com registry in case a developer in our team makes a mistake. Package publish to AWS CA fails with the expected error (see Response 1 below).

Same thing happens when I specify the following publishConfig (see Response 2 below).

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

Question

How do I configure the publishConfig to allow the package to be published to a specific AWS CA domain/registry under our team control? I couldn't find information about it in the AWS Documentation nor on StackOverflow nor anywhere else online.

Response 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

Response 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
gefragt vor 2 Jahren117 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen