Skip to content

Angular CLI >= 20.1.0 - Error [ERR_REQUIRE_ESM] #30849

@SebastianPost1996

Description

@SebastianPost1996

Which @angular/* package(s) are the source of the bug?

cli

Is this a regression?

Yes

Description

As of CLI version 20.1.0, running any ng command, regardless of the project and even in a global context, results in the error below.
Version 20.0.6 does not result in an error.

Unknown error: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\SebastianPost\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\yargs\helpers\helpers.mjs from C:\Users\SebastianPost\AppData\Roaming\npm\node_modules\@angular\cli\src\command-builder\command-module.js not supported.
Instead change the require of C:\Users\SebastianPost\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\yargs\helpers\helpers.mjs to a dynamic import() which is available in all CommonJS modules.
Image

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.1.0
Node: 22.18.0
Package Manager: npm 10.9.3
OS: win32 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions