Toggle between multiple .env files like .env.development with node.js
You can specify which .env file path to use via the path option with something like this: require(‘dotenv’).config({ path: `.env.${process.env.NODE_ENV}` })
You can specify which .env file path to use via the path option with something like this: require(‘dotenv’).config({ path: `.env.${process.env.NODE_ENV}` })
How about use require(‘dotenv’).config({path:__dirname+’/./../../.env’}) ? Your problem seems to be the execution path.