-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling dotenv.config() results in a TypeError #605
Comments
Downgrading to
[Module: null prototype] {
default: { config: [Function: config], parse: [Function: parse] }
} For now you can do: import dotenv from "dotenv"; Aside: In one of my cases I was dynamically importing (only loading on local development not CI) and needed to change to this: ...
const dotenv = await import('dotenv')
dotenv.default.config({ path: './.env' })
... Though this would work too: ...
const {
default: { config },
} = await import('dotenv')
config({ path: './.env' })
... The code change looks to come in from this commit: Before: module.exports.config = config
module.exports.parse = parse After: const DotenvModule = {
config,
parse
}
module.exports = DotenvModule Will see if we can double-up the |
patch for 14.3.0, add back explicit module.exports #605
This is patched in https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md#1431-2022-01-25 |
Since upgrading from dotenv 14.2.0 to 14.3.0 I get the following error when calling
dotenv.config()
CODE (foo.js):
ERROR:
Downgrading to 14.2.0 solves the error.
The text was updated successfully, but these errors were encountered: