title: not getting data from .env file in node.js
body: <p>js and i'm getting error with accessing data from .env file.</p>
  <p>my file structure looks like this:
  <a href="https://i.stack.imgur.com/zUint.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>in .utils folder i have file mail.js where i need to access port and other data from .env</p>
  <p>mail.js</p>
  <pre><code>require(&quot;dotenv&quot;).config({ path: &quot;../.env&quot; });
      
  const port = process.env.email_port;
  const host = process.env.email_host;
  const user = process.env.email_user;
  const pass = process.env.email_pass;
  
  console.log(&quot;port&quot;, port); //undefined
  </code></pre>
  <p>getting undefined here.</p>
  <p>Note: path is correct to .env and variable names are also correct.</p>