publib icon indicating copy to clipboard operation
publib copied to clipboard

Npm not using ~/.npmrc

Open OperationalFallacy opened this issue 2 years ago • 1 comments

I'd like to use npx publib-npm in the pipeline with AWS CodeArtifact, however, it is not using credentials from ~/.npmrc

Successfully configured npm to use AWS CodeArtifact repository https://xxx-xxx.d.codeartifact.us-east-1.amazonaws.com/npm/lib/ 
Login expires in 12 hours at 2023-03-22 23:06:25-04:00

Then error with publish

npx publib-npm                                                                                                                                                           
NPM_TOKEN is required

Native npm publish works properly, using auth from ~/.npmrc npm publish dist/js/lib@${version}.jsii.tgz

With NPM_TOKEN and NPM_REGISTRY variables for the CodeArtifact registry, it errors out with

npx publib-npm          

Unable to locate credentials. You can configure credentials by running "aws configure".
```

OperationalFallacy avatar Mar 22 '23 15:03 OperationalFallacy

We should probably use an env var like this: npm_config_//reg.example/UP_CASE/:_authToken=secret (see https://github.com/npm/config/pull/74)

and also be optional on NPM_TOKEN

mrgrain avatar Sep 16 '25 10:09 mrgrain