user1365697
user1365697

Reputation: 5989

How I can set environment parameter to nodejs with EXPORT?

I have .npmrc with value for scope registry

@myScope:registry="myHtml"

I delete the .npmrc and I want to do it with npm config

I tried export npm_config_@myScope:registry=myHtml and the I got not a valid identifier

I tried export VARNAME="npm_config_@myScope:registry" export VARNAME=myHtml" but it didn't update the environment parameter

Upvotes: 0

Views: 141

Answers (1)

Lazar Nikolic
Lazar Nikolic

Reputation: 4394

You should use Node's Process object for that.

process.env.VARNAME = "myHTML"

This should expose your variable through you project. You can find more about it here: https://nodejs.org/api/process.html#process_process_env

Upvotes: 0

Related Questions