What's the problem?
PR #7070 fixed the EBADF: bad file descriptor, fstat error for Node 25.7+ by reading CJS source of zip files instead of letting Node fstat the fake fd. However, the version gate only checks for Node >= 25.7:
export const HAS_BROKEN_FSTAT_FOR_ZIP_FDS = major > 25 || (major === 25 && minor >= 7);
The same breaking change from nodejs/node#61769 (lib: reduce cycles in esm loader and load it in snapshot, commit ad1078c0) was backported to Node v24.15.0, causing the identical EBADF error on that version.
Confirmed by checking the commits between v24.14.1 and v24.15.0 — PR nodejs/node#61769 is included.
Reproduction
$ node --version
v24.15.0
$ yarn --version
4.14.0
$ yarn install
➤ YN0009: │ unrs-resolver@npm:1.11.1 couldn't be built successfully (exit code 1)
➤ YN0009: │ argon2@npm:0.44.0 couldn't be built successfully (exit code 1)
Build log:
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:391:25)
at readFileSync (node:fs:447:17)
at getSourceSync (node:internal/modules/esm/load:37:14)
at createCJSModuleWrap (node:internal/modules/esm/translators:210:32)
...
Works fine on Node v24.14.1, fails on v24.15.0.
Suggested fix
Widen the version gate in packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts to also cover Node 24.15+:
export const HAS_BROKEN_FSTAT_FOR_ZIP_FDS = major > 25 || (major === 25 && minor >= 7) || (major === 24 && minor >= 15);
What's the problem?
PR #7070 fixed the
EBADF: bad file descriptor, fstaterror for Node 25.7+ by reading CJS source of zip files instead of letting Nodefstatthe fake fd. However, the version gate only checks for Node >= 25.7:The same breaking change from nodejs/node#61769 (
lib: reduce cycles in esm loader and load it in snapshot, commitad1078c0) was backported to Node v24.15.0, causing the identicalEBADFerror on that version.Confirmed by checking the commits between
v24.14.1andv24.15.0— PR nodejs/node#61769 is included.Reproduction
Build log:
Works fine on Node v24.14.1, fails on v24.15.0.
Suggested fix
Widen the version gate in
packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.tsto also cover Node 24.15+: