question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suppress errors of missing .env file for production

See original GitHub issue

Production environments normally don’t have a .env file. In these cases require('dotenv').load() prints the following error to console:

{ [Error: ENOENT, no such file or directory '.env'] errno: -2, code: 'ENOENT', path: '.env', syscall: 'open' }

Shouldn’t these errors be suppressed or at least change into something less frightening?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jcblwcommented, Apr 2, 2015

fixed with #62 release v.1.1.0

now you can silence dotenv

require('dotenv').config({silent: true})
0reactions
kachkaevcommented, Dec 23, 2016

@calebboyd thanks for the hint, I did not know this trick existed. Looks like in v3.0.0 this is no longer the case though. Errors are not shown by default unless you pass a verbose option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotenv file is not loading environment variables - Stack Overflow
Here my project structure is like this. // index. ts import dotenv from 'dotenv'; import path from 'path'; dotenv. config({path: path.
Read more >
Missing Environment Variables Error. - Atlassian Community
Solved: Hello, I have created Environments in deployments namely Development and Production which are using different aws accounts for ...
Read more >
Dot Env Files: The Silent Killer - Tighten Co.
Solution: A command that runs in CI during a build that catches . env. example variables missing from the environment's . env file,...
Read more >
Configure Meilisearch at launch
To configure a Meilisearch instance using environment variables, ... Ignore missing dump. WARNING. This option does not take any values.
Read more >
Scan Environment Variables in Production Application
Ignore Environment Variable ... When you run the application in different environments that time you might want to ignore some environment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found