DEV Community

How to replace Environment Variables in a .npmrc File

Dennis Zimmermann on February 16, 2024

Managing npm registry configurations and authentication tokens can be a tricky task, especially when working collaboratively on multiple projects a...
Collapse
 
noelblaschke profile image
Noel Blaschke

Great tooling!

Does it also work with different yarn versions?

Collapse
 
dennzimm profile image
Dennis Zimmermann

Good point!

I have read that yarn in the latest versions (>= 2) doesn't use the configuration from .npmrc files anymore... They instead read all of the configuration from the .yarnrc.yml files. (v3.yarnpkg.com/getting-started/mig...)

Maybe the package can be adapted in the future so that it also works with the newer versions of yarn, etc..

I have tested a little further:

  • it works with pnpm (8.15.3)
  • it does not work with bun (registries can be configured via bunfig.toml)