oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.81k stars 2.64k forks source link

`@eslint/object-schema` throws `p.stdin.end` is not a function on macOS #12574

Open amareshsm opened 1 month ago

amareshsm commented 1 month ago

What version of Bun is running?

1.1.20+ae1948925

What platform is your computer?

Darwin 21.5.0 arm64 arm

What steps can reproduce the bug?

Description: I tried to build the packages within the Eslint Rewrite. When using Node.js, npm run build functioned correctly on both Windows and macOS. However, when I used the command bun run --bun build on Windows, it performed as expected, whereas on macOS, I encountered the following error:

Building packages in this order: packages/object-schema, packages/config-array, packages/compat, packages/core, packages/migrate-config
Building packages/object-schema...

> @eslint/object-schema@2.1.4 build
> rollup -c && tsc -p tsconfig.esm.json && npm run build:cts

npm ERR! Lifecycle script `build` failed with error: 
npm ERR! TypeError: p.stdin.end is not a function. (In 'p.stdin.end()', 'p.stdin.end' is Infinity) 
npm ERR!   in workspace: @eslint/object-schema@2.1.4 
npm ERR!   at location: /Users/amareshsm/Desktop/Repositories/rewrite/packages/object-schema 
104 | function buildPackages(packageDirs) {
105 |   console.log(`Building packages in this order: ${packageDirs.join(", ")}`);
106 | 
107 |   for (const packageDir of packageDirs) {
108 |           console.log(`Building ${packageDir}...`);
109 |           execSync(`npm run build -w ${packageDir} --if-present`, {
        ^
error: null
   errno: -1
   code: "1"
 syscall: "spawnSync"
   path: "/bin/sh"

      at new SystemError (node:child_process:902:14)
      at node:child_process:175:24
      at node:child_process:226:23
      at buildPackages (/Users/amareshsm/Desktop/Repositories/rewrite/scripts/build.js:109:3)
      at /Users/amareshsm/Desktop/Repositories/rewrite/scripts/build.js:125:1

Bun v1.1.20 (macOS arm64)
error: script "build" exited with code 1
➜  rewrite git:(bun-test) 
src/index.js → dist/cjs/index.cjs, dist/esm/index.js...
created dist/cjs/index.cjs, dist/esm/index.js in 44ms

> @eslint/object-schema@2.1.4 build:cts
> node -e "fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')"

npm ERR! Lifecycle script `build:cts` failed with error: 
npm ERR! TypeError: p.stdin.end is not a function. (In 'p.stdin.end()', 'p.stdin.end' is Infinity) 
npm ERR!   in workspace: @eslint/object-schema@2.1.4 
npm ERR!   at location: /Users/amareshsm/Desktop/Repositories/rewrite/packages/object-schema 

Steps:

  1. Clone the repo
  2. Do npm install
  3. Run Bun build command bun run --bun build

What is the expected behavior?

The packages should be built successfully without any errors.

What do you see instead?

Instead I got the below error:

$ node scripts/build.js
Building packages in this order: packages/object-schema, packages/config-array, packages/compat, packages/core, packages/migrate-config
Building packages/object-schema...

> @eslint/object-schema@2.1.4 build
> rollup -c && tsc -p tsconfig.esm.json && npm run build:cts

npm ERR! Lifecycle script `build` failed with error: 
npm ERR! TypeError: p.stdin.end is not a function. (In 'p.stdin.end()', 'p.stdin.end' is Infinity) 
npm ERR!   in workspace: @eslint/object-schema@2.1.4 
npm ERR!   at location: /Users/amareshsm/Desktop/Repositories/rewrite/packages/object-schema 
104 | function buildPackages(packageDirs) {
105 |   console.log(`Building packages in this order: ${packageDirs.join(", ")}`);
106 | 
107 |   for (const packageDir of packageDirs) {
108 |           console.log(`Building ${packageDir}...`);
109 |           execSync(`npm run build -w ${packageDir} --if-present`, {
        ^
error: null
   errno: -1
   code: "1"
 syscall: "spawnSync"
   path: "/bin/sh"

      at new SystemError (node:child_process:902:14)
      at node:child_process:175:24
      at node:child_process:226:23
      at buildPackages (/Users/amareshsm/Desktop/Repositories/rewrite/scripts/build.js:109:3)
      at /Users/amareshsm/Desktop/Repositories/rewrite/scripts/build.js:125:1

Bun v1.1.20 (macOS arm64)
error: script "build" exited with code 1
➜  rewrite git:(bun-test) 
src/index.js → dist/cjs/index.cjs, dist/esm/index.js...
created dist/cjs/index.cjs, dist/esm/index.js in 44ms

> @eslint/object-schema@2.1.4 build:cts
> node -e "fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')"

npm ERR! Lifecycle script `build:cts` failed with error: 
npm ERR! TypeError: p.stdin.end is not a function. (In 'p.stdin.end()', 'p.stdin.end' is Infinity) 
npm ERR!   in workspace: @eslint/object-schema@2.1.4 
npm ERR!   at location: /Users/amareshsm/Desktop/Repositories/rewrite/packages/object-schema 

image

Additional information

It is failing in CI as well - https://github.com/eslint/rewrite/pull/87

When I used the bun run --bun build command to build each package individually, it worked as expected.

image

amareshsm commented 1 month ago

I also tried to use spawnSync instead of execSync, but encountered the same error.

amareshsm commented 1 week ago

@190n Are you looking into this issue?