Skip to content

bug: yargs issue reappearing in 26.x.x #63694

@darcyrush

Description

@darcyrush

Version

26.2.0

Platform

Linux P3 6.8.0-117-generic #117~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu May  7 22:17:46 UTC  x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Loading a module which depends on yargs

How often does it reproduce? Is there a required condition?

Every time on 26.2.0, 26.1.0 and 26.0.0

Works fine on 24.16.0

What is the expected behavior? Why is that the expected behavior?

Load as normal

What do you see instead?

ReferenceError: require is not defined in ES module scope, you can use import instead
    at file:///home/...../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/yargs:3:69
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:543:37)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:365:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1692:24)
    at Module._compile (node:internal/modules/cjs/loader:1855:5)
    at Object..js (node:internal/modules/cjs/loader:2013:10)
    at Module.load (node:internal/modules/cjs/loader:1596:32)
    at Module._load (node:internal/modules/cjs/loader:1398:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.require (node:internal/modules/cjs/loader:1619:12)

Additional information

Possibly the same issue as #61971 which appears to have been fixed in node 25

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixIssues that will not be fixed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions