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.

Doesn't work with dotenv anymore.

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
maxbeattycommented, May 27, 2019

👋 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 😸)

2reactions
Qix-commented, May 15, 2019

Then you need to open a ticket with them; there’s nothing I can do about that.

Read more comments on GitHub >

github_iconTop 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 >

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