Skip to content

Crash on node v25 #582

Open
Open

Description

@coderaiser
c8 tape 'test/**/*.js'
file:///Users/coderaiser/@cloudcmd/fileop/node_modules/yargs/yargs:3
const {applyExtends, cjsPlatformShim, Parser, Yargs, processArgv} = require('./build/index.cjs')
                                                                    ^

ReferenceError: require is not defined in ES module scope, you can use import instead
    at file:///Users/coderaiser/@cloudcmd/fileop/node_modules/yargs/yargs:3:69
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:534:37)

Fix: #581
Related to yargs/yargs#2509
Possible solution:

Possible solution: superc8 with:

  • ✅ Fixed TODO (parase-args#L176, check-coverage#L14);
  • ✅ ESM-only code;
  • ✅ Updated dependencies, including yargs that works in node v25 and node v26;
  • ✅ Applied 🐊Putout default suggestions;
  • ✅ When tests failed do not report coverage;
  • ✅ Used execa instead of foreground-child;

Activity

  1. uhop commented on Feb 25, 2026

    @uhop

    The easiest way out of it is to update dependencies. Specifically go from yargs 17 to 18 — the major version has changed.

  2. 43081j commented on Feb 26, 2026

    @43081j

    Can confirm this has broken a lot of builds. Basically anything that uses node@latest in CI with c8 (which at least shows using latest node did the intended job of catching these things 😄 ).

  3. sverweij commented on Feb 26, 2026

    @sverweij

    As a workaround I've temporarily added an override to our local package.json like so:

      "overrides": {
        "c8": {
          "yargs": "^18.0.0"
        },
      },

    ... and can confirm that, as @uhop mentions bumping yargs to 18 seems resolve the issue without code changes in c8 (build before override, build after override).

    Edit: Was looking to make a PR to bump yargs in c8 itself, but bcoe already has one cooking: #578. So the 'fix' mentioned in this comment is only for the really impatient :-)

  4. coderaiser commented on Feb 27, 2026

    @coderaiser
    ContributorAuthor

    Possible solution: superc8 with:

    • ✅ Fixed TODO (parase-args#L176, check-coverage#L14);
    • ✅ ESM-only code;
    • ✅ Updated dependencies, including yargs that works on node v25 and node v26;
    • ✅ Applied 🐊Putout default suggestions;
    • ✅ When tests failed do not report coverage;
    • ✅ Used execa instead of foreground-child;
  5. added a commit that references this issue on Feb 28, 2026
  6. added a commit that references this issue on Mar 12, 2026
  7. YasharF commented on May 5, 2026

    @YasharF

    Not working on Node v26 either

  8. 43081j commented on May 13, 2026

    @43081j

    @bcoe do you want any help with this? can open a PR if its of help. would be good to fix this

  9. YasharF commented on Jul 22, 2026

    @YasharF

    I think this is fixed now in v12. @coderaiser can you verify and close this issue if it is fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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