Skip to content

Node 25.7.0 runtime failure from yargs v17 (require is not defined) #708

Description

@chenrui333

After Node 25.7.0 rollout in Homebrew (homebrew/homebrew-core#269249), marp-cli fails at runtime due to yargs v17.

Error:

ReferenceError: require is not defined in ES module scope, you can use import instead
at .../node_modules/yargs/yargs:3
Node.js v25.7.0

Homebrew failure evidence:

Local repro with Homebrew bottle:

  • marp --version fails with the same stack

Upstream context:

Could you cut a fix/release compatible with Node 25.7+ (or otherwise advise a supported workaround)?

Activity

  1. added
    bugSomething isn't working
    upstreamCaused in upstream, not in this repo
    on Mar 2, 2026
  2. linked a pull request that will close this issue[v5] Upgrade yargs to v18 #670on Mar 2, 2026
  3. yhatt commented on Mar 2, 2026

    @yhatt
    Member

    Thank you for organizing the issue clearly 👍

    As workarounds, you can either use a standalone binary (bundles a compatible version of Node.js) or use a stable release of Node.js (even-numbered versions).

    The root cause is expected to be resolved by an update to yargs, #670. However, since it includes incompatibilities with older versions of Node.js, it would be difficult to merge the update immediately. Currently we have to wait for the upstream patch release.

  4. removed
    bugSomething isn't working
    on Mar 2, 2026
  5. stefanhaerter commented on Mar 3, 2026

    @stefanhaerter

    +1 on this issue. Experienced it with Arch Linux. Temporarily downgraded nodejs to 25.4 again - leaving the instructions here in case they are useful: https://wiki.archlinux.org/title/Downgrading_packages

  6. yhatt commented on Mar 3, 2026

    @yhatt
    Member

    It seems Node.js is addressing an incompatible change in nodejs/node#62083. It will probably be fixed in a future version update.

    IMO: To avoid issues caused by the incompatibility from the latest version, it's recommended to use the stable version (even-numbered major versions, LTS) of Node for common use, rather than development versions (odd-numbered major versions).

    UPDATE: Form Node.js v26, you will no longer need to consider whether it is odd or even version: https://nodejs.org/blog/announcements/evolving-the-nodejs-release-schedule

  7. yhatt commented on Mar 7, 2026

    @yhatt
  8. yhatt commented on Mar 11, 2026

    @yhatt
    Member

    Node.js 25.8.1 has been released, with including fixed module resolution.

    Note

    An upcoming Node.js 26+ will reintroduce the renewed module resolution behavior, which revives an error in the current yargs v17. yargs is currently working on forward compatibility: yargs/yargs#2514

  9. yhatt commented on May 5, 2026

    @yhatt
    Member

    Node.js v26 has been released! However, the fix PR of yargs is not yet merged and shipped, so this error is re-introduced in Node.js 26.

  10. reopened this on May 5, 2026
  11. stefanhaerter commented on May 5, 2026

    @stefanhaerter

    Thank you for the heads up 😊

  12. linked a pull request that will close this issueTest against Node.js v26 #722on May 6, 2026
  13. yhatt commented on May 6, 2026

    @yhatt
    Member

    Fixed in v4.4.0. We're getting an error because Marp CLI uses yargs via require('yargs/yargs'), so we've bundled yargs into Marp CLI to avoid this.

  14. yhatt commented on Jun 19, 2026

    @yhatt
    Member

    Note

    yargs has been released the patch version for v16 and v17 to resolve this problem. Even if used older version of Marp CLI in Node.js 26, this error should not be reproduced if installed the latest v17 yargs release by following the semver range specified in package.json

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

    upstreamCaused in upstream, not in this repo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions