SyntaxError: The requested module ‘dotenv’ does not provide an export named ‘default’

When we try to use modules in out TypeScript applications we encounter the error message

SyntaxError: The requested module 'dotenv' does not provide an export named 'default'

This is caused by the missing “default” export in the module’s code. To eliminate the error message modify the import statement as

import * as dotenv from "dotenv";
dotenv.config() 

Leave a comment

Your email address will not be published. Required fields are marked *