Skip to content

Error ERR_REQUIRE_ESM #2

@coygeek

Description

@coygeek

ISSUE OBSERVED

I ran 2 commands and saw the following:

1st: NPX

➜  ~/Desktop/2025-08-09-statusline git:(main) npx @mariozechner/cchistory 1.0.0 --latest
Need to install the following packages:
@mariozechner/cchistory@1.1.9
Ok to proceed? (y) y

/Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/@mariozechner/cchistory/dist/index.js:44
const chalk_1 = __importDefault(require("chalk"));
                                ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/chalk/source/index.js from /Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/@mariozechner/cchistory/dist/index.js not supported.
Instead change the require of /Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/chalk/source/index.js in /Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/@mariozechner/cchistory/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/user/.npm/_npx/0e1773d7e740e66b/node_modules/@mariozechner/cchistory/dist/index.js:44:33) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.11.0
➜  ~/Desktop/2025-08-09-statusline git:(main)

2nd: NPM

➜  ~/Desktop/2025-08-09-statusline git:(main) npm install -g @mariozechner/cchistory

added 2 packages in 479ms

1 package is looking for funding
  run `npm fund` for details
➜  ~/Desktop/2025-08-09-statusline git:(main) cchistory 1.0.0
/usr/local/lib/node_modules/@mariozechner/cchistory/dist/index.js:44
const chalk_1 = __importDefault(require("chalk"));
                                ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/@mariozechner/cchistory/node_modules/chalk/source/index.js from /usr/local/lib/node_modules/@mariozechner/cchistory/dist/index.js not supported.
Instead change the require of /usr/local/lib/node_modules/@mariozechner/cchistory/node_modules/chalk/source/index.js in /usr/local/lib/node_modules/@mariozechner/cchistory/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/usr/local/lib/node_modules/@mariozechner/cchistory/dist/index.js:44:33) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.11.0
➜  ~/Desktop/2025-08-09-statusline git:(main)

Claude Version

➜  ~ claude --version
1.0.80 (Claude Code)
➜  ~ which claude
/Users/user/.local/bin/claude
➜  ~ 

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