Search code examples
npmlerna

How can I configure the auth parameter when using lerna publish?


I have an .npmrc set up to publish to a private registry, but I do not want to check in auth credentials. How do I provide the _auth config when running lerna publish?

Unfortunately lerna publish does not accept the _auth flag: https://github.com/lerna/lerna/tree/master/commands/publish#options


Solution

  • I found out you can set npm config parameters using environment variables, so this does the trick:

    npm_config__auth=AUTH npx lerna publish # yes, double underscore