Unknown error: Error [ERR_REQUIRE_ESM]: require() of ES Module

Discussão em 'Angular' iniciado por Zvi Vered, Agosto 8, 2025.

  1. Zvi Vered

    Zvi Vered Guest

    In order to install last angular version locally and create a project I ran:

    npx -p @angular/cli ng new Tester


    and got:

    Node.js version v21.2.0 detected.
    Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/previous-releases/.
    Unknown error: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\990598\AppData\Local\npm-cache\_npx\9352468a5c6c6c18\node_modules\yargs\helpers\helpers.mjs not supported.
    Instead change the require of C:\Users\990598\AppData\Local\npm-cache\_npx\9352468a5c6c6c18\node_modules\yargs\helpers\helpers.mjs to a dynamic import() which is available in all CommonJS modules.


    Can you please tell what is the cause to this error ?

    I also tried another way:

    mkdir Tester
    npm install @angular/cli
    cd ..
    Tester\node_modules\.bin\ng new Tester


    But I got the same error.

    Continue reading...

Compartilhe esta Página