I'm using npmrc
to setup my corporate (using CodeArtifact) and public (using registry.npmjs.org
) NPM registries.
The problem is that, even with the public profile selected, I keep getting an error that the authentication to CodeArtifact is missing. The only way to get rid of this is authenticating on CodeArtifact, which causes the auth token to be set to both profiles. After that, regardless the profile selected, both uses CodeArtifact as a registry.
I tried extreme measures and deleted all my profiles and create a single one set to registry.npmjs.org
. Still, NPM (and Yarn) complain about missing auth to CodeArtifact.
Any ideas?
Assuming you are using
aws codeartifact login --tool npm --repository my-repo --domain my-domain
to login into aws you should use a more granular approach use the following commands:These commands are a deconstruction of
aws codeartifact login --tool npm --repository my-repo --domain my-domain
(more info), with the difference that instead of setting a generalregistry
at your.npmrc
file (used to set configurations for your npm) will set a scoped registry (more info). In this way you will be able to have you fetch your packages from the sources you want. In your case have access toregistry.npmjs.org
without being asked for auth.