title: NodeJS not recognizing .env file
body: <p>I have like 5 NodeJS services running, but I have a problem in one of those.</p>
  
  <p>This is the <code>nodemon.json</code> file:</p>
  
  <pre><code>{
    "watch": ["**/*.ts"],
    "ext": "ts,json",
    "ignore": ["./test/*.ts"],
    "exec": "node -r ts-node/register -r dotenv/config Index.ts dotenv_config_path=$(pwd)/.env",
    "env": {
      "NODE_ENV": "development"
    }
  }
  </code></pre>
  
  <p>It's the same as the rest of services. When I run <code>npm run dev</code> I got error messages depending on which value is taking from the .env file, example:</p>
  
  <pre><code>const LOCAL_CONFIGURATION = {
      PORT_APP: 8082,
      MONGODB: {
          SERVER: process.env.MONGO_DTE,
          AUTH: {
              auth: {
                  password:process.env.MONGO_PASSWORD,
                  user:process.env.MONGO_USER
              }
          },
      },
      MS_NOTIFICACION: "http://localhost:8089/notificacion",
      ELASTIC_PATH: process.env.ELASTIC_PATH,
      ...COMMON,
  };
  </code></pre>
  
  <p>The first error message is:
  <code>ConfigurationError: Missing node(s) option</code>
  That message is produced because it's not reading the value from <code>process.env.ELASTIC_PATH</code>, but if I put a hardcoed value like "<a href="http://with.the.correct.url" rel="noreferrer">http://with.the.correct.url</a>" and it tries again to run, I get another error:</p>
  
  <p><code>Error: Credentials must be provided when creating a service client</code>
  That error is because it's trying to read <code>password:process.env.MONGO_PASSWORD</code> and <code>user:process.env.MONGO_USER</code> </p>
  
  <p>etc, so, there's a problem on reading the <code>.env</code> file. I know that <code>.env</code> file has those values, and the file is in UTF-8, without quotes, etc. The <code>.env</code> file is the same file as the other services, it works ok in the rest but I don't know why is not getting read here.</p>
  
  <p>Any idea?</p>
  
  <p>EDIT:</p>
  
  <p><a href="https://i.stack.imgur.com/N9uHU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N9uHU.png" alt="enter image description here"></a></p>
  
  <p>Plus, I put a  <code>console.log(process.env);</code> in <code>config.ts</code> file and it shows values like this:</p>
  
  <p><a href="https://i.stack.imgur.com/DZOIJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DZOIJ.png" alt="enter image description here"></a></p>
  
  <p>But there's no values from the <code>.env</code> for example, there in the picture there's a value called <code>COMPUTERNAME</code> so if I put <code>console.log(process.env.COMPUTERNAME);</code> I get: <code>IBM-NOT87</code></p>
  
  <p>Why is not getting the .env file?</p>