Skip to content

ERR_REQUIRE_ESM on node v20.13.1 when using CLI #40

@ghost

Description

Got ERR_REQUIRE_ESM when using the CLI, below is part of the error.

...
const ora_1 = __importDefault(require("ora"));

Error [ERR_REQUIRE_ESM]: require() of ES Module <paths_in_my_file_system>\node_modules\ora\index.js from <paths_in_my_file_system>\node_modules\@better-auth-cloudflare\cli\dist\index.js not supported.
...

Apparently this is caused by the ora package not supporting being imported from a commonjs project using require: sindresorhus/ora#239

I'm able to run the cli using node v24, and v20.19.5, likely due to this: https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require, and I suspect it might work with some older versions with the --experimental-require-module flag.

Given that the feature was only added roughly one year ago, I think it's worth adding a line in the docs reminding people to update their node if they are having this error when using the CLI.

And thanks for this plugin!

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