Doesn't work with dotenv anymore.
See original GitHub issueThe following code snippet works with the version 3.2.6
but it doesn’t work with 4.1.1
.
import dotenv from 'dotenv';
dotenv.config();
const debug = require('debug');
const log = debug('app');
log('Something');
I’ve checked the 4.x change logs but I couldn’t find anything related to this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
dotenv file is not loading environment variables - Stack Overflow
This solved my issues in Node v8.14.1 : const path = require('path') require('dotenv').config({ path: path.resolve(__dirname, '../.env') }).
Read more >Doesn't work with dotenv anymore. · Issue #705 - GitHub
It is set to app . When I run it with DEBUG=app yarn start it logs to the console, but if I set...
Read more >Why dotenv is unnecessary! - Medium
Most articles on the web recommend to use dotenv to manage environment variables. It turns out that you can easily load them without...
Read more >5 reasons why your .env environment variables don't work
1. Your framework doesn't automatically load .env files. · 2. You added or otherwise updated your .env file after starting your server. ·...
Read more >Only use dotenv in development - Simon Plenderleith
The dotenv library is a popular way of loading configuration for your Node.js ... This typically means it won't get deployed to production....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👋 maintainer of dotenv here. from what I was able to reproduce in https://github.com/motdotla/dotenv/pull/398 dotenv is working, debug is working, but mixing together with babel-node seems to not work as expected. if anyone would like to help complete the example in that PR (i.e. make it work), that will help identify which package, if any, needs an update ❤️ I’m also open to any other fully re-produceable examples (i.e. not code snippets in comments 😸)
Then you need to open a ticket with them; there’s nothing I can do about that.