Process and use enviroment variable in nodejs in ubuntu

61 Views Asked by At

Haev any different when use env variable in window and linux. In window i call normally with process.env.variable_name and can get the value in env file. but when in ubuntu, it can't

# .env

MY_ENV_VAR=my_value

// app.js

const dotenv = require("dotenv");

// Add dotenv.config() to the top of the script dotenv.config();

// Use the environment variable const myEnvVar = process.env.MY_ENV_VAR;

console.log(myEnvVar); // my_value

what i need to do in ubuntu to run normally like in window

0

There are 0 best solutions below