Skip to content

CI tests fail under Node.js 24.15.0 LTS (EBADF) #813

Description

@MikeMcC399

Current behavior

Running typecheck, lint or test, as used in .github/workflows/ci.yml, fails when run locally under Node.js 24.15.0 LTS with:

Error: EBADF: bad file descriptor, fstat

This issue can also be expected to appear soon appears under GitHub Actions and causes CI workflow failure if / when since the cached Node.js versions in GitHub Actions runner images are updated to include Node.js 24.15.0 LTS.

Expected behavior

It should be possible to test Corepack successfully under Node.js Active LTS, including under the latest release Node.js 24.15.0.

Versions

Corepack 0.34.7
Ubuntu 24.04.4 LTS
Node.js 24.15.0 (Active LTS)
Yarn 4.11.0

Steps to reproduce

Install Node.js 24.15.0 LTS, then execute:

git clone https://github.com/nodejs/corepack
cd corepack
npm uninstall yarn -g # if previously installed
npm install corepack -g
corepack yarn install
corepack yarn build
corepack yarn typecheck
corepack yarn lint
corepack yarn test

Logs

$ corepack yarn install
corepack yarn build
corepack yarn test
➤ YN0000: · Yarn 4.11.0
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 250ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ better-sqlite3@npm:11.10.0 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.27.7 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1m 1s
➤ YN0000: · Done with warnings in 1m 2s

  dist/lib/corepack.cjs  954.6kb

⚡ Done in 66ms
All shims have been generated.
node:fs:391
  const stats = binding.fstat(fd, false, undefined, true /* shouldNotThrow */);
                        ^

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)
    at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:349:10)
    at #translate (node:internal/modules/esm/loader:451:20)
    at afterLoad (node:internal/modules/esm/loader:507:29)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:512:12)
    at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:555:36)
    at afterResolve (node:internal/modules/esm/loader:603:52) {
  errno: -9,
  code: 'EBADF',
  syscall: 'fstat'
}

Node.js v24.15.0

Other

The corresponding Yarn Berry issues:

state that this issue is fixed in yarn@v4.14.1

The results of attempting to fix with an upgrade are as follows:

command Yarn 4.11.0 Yarn 4.14.1
corepack yarn typecheck Error: EBADF success
corepack yarn lint Error: EBADF TypeError
corepack yarn test Error: EBADF success

TypeError issue carried over to #814 for issue separation purposes.

Activity

  1. MikeMcC399 commented on Apr 19, 2026

    @MikeMcC399
    ContributorAuthor

    PR #652 from @geigerzaehler could be reopened and rebased to workaround the Yarn pnp issues in this repo that affect only CI tests and usage. The PR migrates Corepack from Yarn pnp to Yarn node-modules.

    Resolution of the general issue that Yarn pnp users are having could then be decoupled from Corepack needs.


    PR #652 was originally rejected with the statement:

    I'll close it then; as a package manager author I find it somewhat reassuring to have at least one Node.js project using PnP (or loaders in general). If Corepack moves out of the Node.js org it can be revisited.

    That has proved to be ineffective as an advance test of compatibility, since Yarn users outside of Corepack have already found and reported the issue, whereas here in the Corepack repo the issue has not yet caused a failure. It's only been reported here because I manually tested compatibility locally. The fact that CI has not yet failed is also due to CI not having been extended to test under Node.js 25. The highest test version is Node.js 24.

  2. MikeMcC399 commented on Apr 21, 2026

    @MikeMcC399
    Author
  3. MikeMcC399 commented on Apr 24, 2026

    @MikeMcC399
    Author
  4. MikeMcC399 commented on Apr 24, 2026

    @MikeMcC399
    ContributorAuthor

    macos-latest / macos-15 is now deployed to use Node.js 24.15.0 and so there is now a hard error testing macOS with Node.js 24. Every Dependabot version update PR now fails.

    #817 proposes a resolution.

  5. MikeMcC399 commented on May 6, 2026

    @MikeMcC399
    Author
  6. MikeMcC399 commented on May 11, 2026

    @MikeMcC399
    ContributorAuthor

    It's also a race for who is first concerning the corepack yarn lint error on Node.js 24.15.0:

    • Node.js is scheduling a release of 24.16.0 for 2026-05-21 including PR fs: restore fs patchability in ESM loader node#62835
    • GitHub Actions is scheduling runner image updates for May 19 - May 26, 2026 to update the default Node.js version from 20 to 22. It's unclear whether there will be a deployment for ubuntu-latest prior to those dates which updates the cached Node.js version from 24.14.1 to 24.15.0 at the same time
  7. MikeMcC399 commented on May 14, 2026

    @MikeMcC399
    ContributorAuthor

    I'm closing this now, as EBADF is no longer occurring.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions