Home > database >  Why can I not publish npm module to Google Artifact Registry?
Why can I not publish npm module to Google Artifact Registry?

Time:03-25

I run

npx google-artifactregistry-auth --verbose

And I seem to log in properly...

Retrieving application default credentials... Success!

So now I try to deploy and get...

npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://us-central1-npm.pkg.dev/my-proj/npm-public/
npm ERR! need auth You need to authorize this machine using `npm adduser`

I have set the roles/artifactregistry.writer role on the IAM service account used to generate the key file.

What am I missing?

CodePudding user response:

The registry info had to be in $WORKING_DIR/.npmrc not ~/.npmrc.

Once I ran gcloud beta artifacts print-settings npm --repository=npm-public --location=us-central1 > .npmrc and then re-ran npx google-artifactregistry-auth I could publish. I tried using ~/.npmrc for the --repo-config but it still did not work

  • Related