Skip to content

Calling dotenv.config() results in a TypeError #605

@bankslenus

Description

@bankslenus

Since upgrading from dotenv 14.2.0 to 14.3.0 I get the following error when calling dotenv.config()

CODE (foo.js):

...
import * as dotenv from "dotenv";
dotenv.config(); // line 20
...

ERROR:

$ yarn build
$ tslint -c tslint.json -p tsconfig.json --fix
$ tsc
$ node --es-module-specifier-resolution=node .
file:///..../foo.js:20
dotenv.config();
       ^

TypeError: dotenv.config is not a function
    at file:///..../foo.js:20:8
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

Downgrading to 14.2.0 solves the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions