You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
From reading linked PRs, it seems that it is intentional that Node 26 behaves this way but I will let someone with more knowledge decide and close the issue if so.
Activity
[-]yargs issue reappearing in 26.x.x[/-][+]bug: yargs issue reappearing in 26.x.x[/+]darcyrush commentedon Jun 1, 2026
From reading linked PRs, it seems that it is intentional that Node 26 behaves this way but I will let someone with more knowledge decide and close the issue if so.
Renegade334 commentedon Jun 1, 2026
Working as intended. See #62176 and yargs/yargs#2509 for context.