oven-sh / bun

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

bun create react-app fails unless Node is installed #5995

Open ajb-oce opened 1 year ago

ajb-oce commented 1 year ago

What version of Bun is running?

1.0.3+25e69c71e70ac8a0a88f9cf15b4057bd7b2a633a

What platform is your computer?

Darwin 21.6.0 arm64 arm

What steps can reproduce the bug?

Without node installed:

  1. install bun using curl command

  2. install react using bun install react

  3. try to create a new react app using bun create react-app <dirname>

  4. Fails

  5. Install Node using brew install node

  6. re-attempt create new react app using bun create react-app <dirname>

  7. success

What is the expected behavior?

Should create a new react-app Success! Created bun-react-app at /Users/users/Documents/Projects/bun-react-app

What do you see instead?

user@macbook Projects % bun create react-app bun-react-app

Creating a new React app in /Users/user/Documents/Projects/bun-react-app.

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts...

Aborting installation. Unexpected error. Please report it as a bug: 605 | } 606 | get stdio() { 607 | return this.#stdioObject ??= this.#createStdioObject(); 608 | } 609 | 610 | spawn(options) { ^ TypeError: Executable not found in $PATH: "npm" code: "ERR_INVALID_ARG_TYPE"

  at spawn (node:child_process:610:14)
  at node:child_process:2:40
  at spawn (/private/tmp/create-react-app@latest--bunx/node_modules/cross-spawn/index.js:12:20)
  at /private/tmp/create-react-app@latest--bunx/node_modules/create-react-app/createReactApp.js:383:18
  at new Promise (:1:20)
  at install (/private/tmp/create-react-app@latest--bunx/node_modules/create-react-app/createReactApp.js:334:9)
  at /private/tmp/create-react-app@latest--bunx/node_modules/create-react-app/createReactApp.js:461:15
  at processTicksAndRejections (:55:76)

Deleting generated file... package.json Deleting bun-react-app/ from /Users/user/Documents/Projects Done.

Additional information

No response

maunzCache commented 3 months ago

Still present in 1.1.17 on amd64 ArchLinux (non-package installation via install.sh)

Unexpected error. Please report it as a bug:
 7 | function spawn(command, args, options) {
 8 |     // Parse the arguments
 9 |     const parsed = parse(command, args, options);
10 | 
11 |     // Spawn the child process
12 |     const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
                            ^
TypeError: Executable not found in $PATH: "npm"
 code: "ERR_INVALID_ARG_TYPE"

      at spawn (node:child_process:721:8)
      at node:child_process:2:21
      at spawn (/tmp/bunx-1000-create-react-app@latest/node_modules/cross-spawn/index.js:12:24)
      at /tmp/bunx-1000-create-react-app@latest/node_modules/create-react-app/createReactApp.js:383:19
      at new Promise (:1:11)
      at install (/tmp/bunx-1000-create-react-app@latest/node_modules/create-react-app/createReactApp.js:334:10)
      at /tmp/bunx-1000-create-react-app@latest/node_modules/create-react-app/createReactApp.js:461:16