Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Environment variable is undefined #207

Open
orangeagain opened this issue Apr 17, 2022 · 1 comment
Open

Environment variable is undefined #207

orangeagain opened this issue Apr 17, 2022 · 1 comment

Comments

@orangeagain
Copy link

After set "INFURA_KEY" "MNEMONIC" "OWNER_ADDRESS"
and rename .env.example to .env
run yarn truffle deploy --network rinkeby

report error:
"Please set a mnemonic and ALCHEMY_KEY or INFURA_KEY."

console.log(INFURA_KEY), print undefine

I don't know which step wrong, and use "npm install dotenv --save" and add "require('dotenv').config()"
to solve this problem temporary

@asghar2016
Copy link

install dotenv module ( npm i dotenv --save )

require('dotenv').config() //write inside the file where you will use the variable

console.log(process.env.NODE_ENV) // returns value stored in .env file

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants