Jinwoo Nam
Jinwoo Nam

Reputation: 77

How to use .env variables inside .npmrc?

I want to use .env file variables in .npmrc file. Is that possible?

I know we can run export SOME_PRIVATE_GITHUB_ACCESS_TOKEN=1234 before run npm install, but I don't want to do that everytime. I want to keep it inside .env.

# .env
SOME_PRIVATE_GITHUB_ACCESS_TOKEN=1234
# .npmrc
@some-private-repo:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${SOME_PRIVATE_GITHUB_ACCESS_TOKEN}

Upvotes: 0

Views: 1117

Answers (1)

user116313
user116313

Reputation: 25

You can try to use npmrc-replace-env which would generate the .npmrc file for you from .npmrc.config and .env file

Upvotes: 0

Related Questions