oven-sh / bun

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

generalised issues with `bun create` command #4646

Closed crushr3sist closed 1 year ago

crushr3sist commented 1 year ago

What version of Bun is running?

1.0.0

What platform is your computer?

Powershell Microsoft Windows NT 10.0.22621.0 x64 WSL2 Ubuntu 22.0 Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

bun create react -> error: could not determine executable to run for package create-react and bun create vite

:~$ bun create vite
✔ Project name: … vite-project
? Select a framework: › - Use arrow-keys. Return to submit.
❯   Vanilla
    Vue
    React
    Preact
    Lit
    Svelte
    Solid
    Qwik
    Others
to which it hangs. 

What is the expected behavior?

The handler from bun hangs when trying to create a vite fronted application. It locks out the whole terminal and no exit commands would work, I thoroughly waited for 20 minutes and no resolve.

itsjavi commented 1 year ago

I have the same issue with bun create react on macOS 13 Ventura. Is it because I have node installed? Idk. I am new to bun

Jawkx commented 1 year ago

Same problem form me, pretty frustrated when the most basic scaffolding can't even work.

Fiontan commented 1 year ago

Also on windows 10 wsl, bunx DOES NOT run for me, but bun x does, however, 👍 bun create react-ssr 1 | (function (bindingName){"use strict";if(bindingName==="constants")return @processBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue});@throwTypeError(process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.)}) ^ TypeError: process.binding("util") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample. at binding (:1:20) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68253 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:76016 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:56311 at t (/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:79269) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:79828 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:80348 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68101 at r (/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:1122) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:1296

bun x create-next-app 1 | (function (bindingName){"use strict";if(bindingName==="constants")return @processBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue});@throwTypeError(process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.)}) ^ error: process.binding("fs") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/3546 at binding (:1:20) at 6748 (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:25778) at nccwpck_require (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:123148) at 6036 (/xxx/global/node_modules/create-next-app/dist/index.js:461:51341) at nccwpck_require (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:123148) at 2127 (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:50944) at nccwpck_require (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:123148) at 2027 (xxx/Data/global/node_modules/create-next-app/dist/index.js:461:107796) at nccwpck_require (/xxx/Data/global/node_modules/create-next-app/dist/index.js:461:123148) at /xxx/Data/global/node_modules/create-next-app/dist/index.js:461:124017 error: "create-next-app" exited with code 1 (SIGHUP)

bun create react-ssr 1 | (function (bindingName){"use strict";if(bindingName==="constants")return @processBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue});@throwTypeError(process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.)}) ^ TypeError: process.binding("util") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample. at binding (:1:20) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68253 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:76016 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:56311 at t (/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:79269) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:79828 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:80348 at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:68101 at r (/tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:1122) at /tmp/create-react-ssr@latest--bunx/node_modules/esm/esm.js:1:1296

sonyarianto commented 1 year ago

refer to #4664

Torniojaws commented 1 year ago

Same thing on Linux:

$ lsb_release -d
Description:    Ubuntu 20.04.6 LTS
$ bun -v
1.0.0
$ bun create react test
error: could not determine executable to run for package create-react
bdharrington7 commented 1 year ago

Same on macOS:

brian@Darunia bun % bun --version
1.0.0
brian@Darunia bun % bun create react
error: could not determine executable to run for package create-react
brian@Darunia bun % sw_vers
ProductName:        macOS
ProductVersion:     13.4.1
ProductVersionExtra:    (c)
BuildVersion:       22F770820d

M1 Mac:

brian@Darunia bun % arch
arm64
KlayHao commented 1 year ago

how-bun-create-works

What version of Bun is running?

1.0.0

What platform is your computer?

Powershell Microsoft Windows NT 10.0.22621.0 x64 WSL2 Ubuntu 22.0 Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

bun create react -> error: could not determine executable to run for package create-react and bun create vite

:~$ bun create vite
✔ Project name: … vite-project
? Select a framework: › - Use arrow-keys. Return to submit.
❯   Vanilla
    Vue
    React
    Preact
    Lit
    Svelte
    Solid
    Qwik
    Others
to which it hangs. 

What is the expected behavior?

The handler from bun hangs when trying to create a vite fronted application. It locks out the whole terminal and no exit commands would work, I thoroughly waited for 20 minutes and no resolve.

moneychien19 commented 1 year ago

Same in docker container (Linux amd64)

# bun --version
1.0.0
# bun create react ./bun-react-app
error: could not determine executable to run for package create-react
itsjavi commented 1 year ago

pleate use command: bun create react-app your-project-name @KlayHao

I don't think bun create react-app is having any benefit from bun, it's using npm and I get a package-lock.json file instead of a bun.lockb

image

gjonhajdari commented 1 year ago

I have the same issue running MacOS Ventura 13.5.1.

Running something like bun create react-app works but it's basically the same as running npx create-react-app.

gjonhajdari@chonatan ~ % bun -v
1.0.0
gjonhajdari@chonatan ~ % bun create react test-app
error: could not determine executable to run for package create-react
ShimiShimson commented 1 year ago

Same here on win 10 pro WSL Ubuntu image

PorthoGamesBR commented 1 year ago

Same here, windows 11 Ubuntu WSL. Bunx doesnt seem to work too bun create react bun x create-react-app

Marcoshsc commented 1 year ago

Same here, windows 11 Ubuntu WSL. Bunx doesnt seem to work too bun create react bun x create-react-app

exact same error here. Using WSL Ubuntu.

shafiqimtiaz commented 1 year ago

Same here on Ubuntu

Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

~/Desktop/Github/bun_react > bun -v
1.0.0
~/Desktop/Github/bun_react > bun create react
error: could not determine executable to run for package create-react
nim-f commented 1 year ago

Same om Mac Ventura 13.4.1

arunattri26 commented 1 year ago

bun create react-app my-react-app --template typescript It works successfully on Mac Ventura 11.6

iliareshetov commented 1 year ago

React: bunx create-vite@latest bun-vite Next.js: bunx create-t3-app@latest bun-t3

Yonben commented 1 year ago

@arunattri26 @iliareshetov using these don't get us the benefits of Bun. It uses non optimized templates afaik.

+1 for the issue on my side as well, Mac M1 on Ventura 13.5.1:

> bun create react app-name
error: could not determine executable to run for package create-react
> bun -v
1.0.0
iliareshetov commented 1 year ago

@arunattri26 @iliareshetov using these don't get us the benefits of Bun. It uses non optimized templates afaik.

+1 for the issue on my side as well, Mac M1 on Ventura 13.5.1:

> bun create react app-name
error: could not determine executable to run for package create-react
> bun -v
1.0.0

Hello @Yonben ,

It appears that there might be a slight misunderstanding. Using bunx create-vite@latest bun-vite actually provides the advantages of Bun. If you were to give it a try, you could easily confirm this.

On the other hand, it's worth noting that creating a React application through create-react-app is not the recommended method according to the official React documentation. You may want to refer to their guidance on Starting a New React Project.

Yonben commented 1 year ago

@iliareshetov thanks for the answer! However Bun guide shows we are required to manually change the vite script to get some advantages of Bun https://bun.sh/guides/ecosystem/vite.

They also add the following note at the start

While Vite currently works with Bun, it has not been heavily optimized, nor has Vite been adapted to use Bun's bundler, module resolver, or transpiler.

I mostly wish things were clearer then 😓

artenlf commented 1 year ago

@arunattri26 @iliareshetov using these don't get us the benefits of Bun. It uses non optimized templates afaik. +1 for the issue on my side as well, Mac M1 on Ventura 13.5.1:

> bun create react app-name
error: could not determine executable to run for package create-react
> bun -v
1.0.0

Hello @Yonben ,

It appears that there might be a slight misunderstanding. Using bunx create-vite@latest bun-vite actually provides the advantages of Bun. If you were to give it a try, you could easily confirm this.

On the other hand, it's worth noting that creating a React application through create-react-app is not the recommended method according to the official React documentation. You may want to refer to their guidance on Starting a New React Project.

My terminal still freezing on variant selection. I can select react template, however the next step is the variant selection.

For context, I'm on Win 10 WSL 2 Ubuntu 22.04.2 LTS

iliareshetov commented 1 year ago

@arunattri26 @iliareshetov using these don't get us the benefits of Bun. It uses non optimized templates afaik. +1 for the issue on my side as well, Mac M1 on Ventura 13.5.1:

> bun create react app-name
error: could not determine executable to run for package create-react
> bun -v
1.0.0

Hello @Yonben , It appears that there might be a slight misunderstanding. Using bunx create-vite@latest bun-vite actually provides the advantages of Bun. If you were to give it a try, you could easily confirm this. On the other hand, it's worth noting that creating a React application through create-react-app is not the recommended method according to the official React documentation. You may want to refer to their guidance on Starting a New React Project.

My terminal still freezing on variant selection. I can select react template, however the next step is the variant selection.

For context, I'm on Win 10 WSL 2 Ubuntu 22.04.2 LTS

Hello @artenlf,

I encountered a similar issue on a Windows machine, but I was able to resolve it by upgrading Git to the latest version. I suggest giving it a try!

artenlf commented 1 year ago

Hello @artenlf,

I encountered a similar issue on a Windows machine, but I was able to resolve it by upgrading Git to the latest version. I suggest giving it a try!

Thanks @iliareshetov. Still doesn't work even upgrading Git to version 2.42.0.

PorthoGamesBR commented 1 year ago

React: bunx create-vite@latest bun-vite Next.js: bunx create-t3-app@latest bun-t3

Vite freezes on the second input (The one to select between typescript and javascript). Didn't try next.js yet

0xOlias commented 1 year ago

To anyone expecting bun create react to work:

When you run bun create react, Bun uses the create-react NPM package which is unfinished/broken. You're looking for create-react-app, which you can run using bun create react-app (this works on my machine).

The create-react package doesn't work with any of the package managers - npm create react and pnpm create react yield the same error as Bun (no binaries/executables found).

Also, use Vite, create-react-app is effectively deprecated.

developerrowan commented 1 year ago

I haven't been able to get any create installer to run on Ubuntu 22.04. Not Next, not Svelte, not Vite.

Svelte will run but when you get past the first input, it takes your inputs and displays them in the console. The program has effectively terminated.

Next will refuse to run due to "process.binding('fs') not being supported by Bun."

Vite will run but freeze once you get to the second question.

I was looking forward to trying the 1.0 release of Bun, but seems there's some issues to be worked out; in the meanwhile, can still benefit from the rest it has to offer!

TreeOfLearning commented 1 year ago

Even if vite did work, to my understanding we would not be getting the full power of Bun because it would not be using Bun's bundler and runtime. Right?

For react purposes (since this issue seems to have mostly devolved into vite/react project creation) it seems to me that the creators of Bun need to come up with their own react template that uses Bun end-to-end; otherwise, we're just trying to create a half-baked solution that doesn't really leverage the full benefits of Bun. (FWIW - the nextjs template also doesn't use Bun's bundler etc - the docs say so themselves!)

Req commented 1 year ago

To anyone expecting bun create react to work

The mechanism why it doesn't work is clear, but the issue is that this is how a lot of people start to try bun, because it's been said in multiple places that this is the way.

For example:

I saw both these thinking should I now finally check out Bun - so far, not a great experience :grimacing:

[Edit] I have looked at the first page multiple times and just now noticed the deprecation message while editing this comment of mine. Neat that the text there is large but still it's not nearly obvious enough that this page is not to be trusted

dezoito commented 1 year ago

Same issue on Linux Mint 21.1 (Ubuntu 22.04)

bun -v  
1.0.1
trungsky commented 1 year ago

Same issue on ubuntu 20.04

bun version 1.0.1

colinhacks commented 1 year ago

tldr: bun create react is not longer a valid command. We recommend using bun create vite or bun create react-app instead.

Previously, bun create used an internal list of sample projects that we maintained. We've since switched it to match npm and others, so bun create <template> equivalent to running bunx create-<template>. Since there's no create-react package on npm, the command fails.

If you run npm create react or yarn create react you'll see the same error.

No longer valid

$ bun create react

Use this instead

$ bun create vite
$ bun create react-app
essexgit commented 1 year ago

u

Colin - if it's a duplicate please post the issue track as you did with WSL freeze #4664

I still get the error on bun 1.01 - at the very least the instructions are incorrect. Not supporting ReactJS is a potential showstopper:

 bun create react
error: could not determine executable to run for package create-react
> bun create react ./hangman
error: could not determine executable to run for package create-react
colinhacks commented 1 year ago

It's not an issue — bun create react is an invalid command. If you run npm create react or yarn create react you'll see the same message.

Previously, bun create used an internal list of sample projects that we maintained. We've since switched it to match npm and others, so bun create <template> is equivalent to running bunx create-<template>. And because there's no create-react template on npm, the command fails.

We'll "solve" this issue by printing a more informative error message when bun create react is executed, this will land in 1.0.2 👍

https://github.com/oven-sh/bun/pull/5248

jcfj commented 1 year ago

Is it possible that this is having some side-effects? (Apologies if my understanding of npm is broken here.) image
image

essexgit commented 1 year ago

bun create react-app still calls create-react-app and fails:

execa/lib/errname: unable to establish process.binding('uv') 1 | (function (bindingName){"use strict";if(bindingName==="constants")return @p rocessBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue}`);@throwTypeError(`process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.`)}) ^ error: process.binding("uv") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/2891 at binding (:1:20) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:0 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:128061 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:127427 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:126485 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:124600

1102 | res => { 1103 | if (res.statusCode === 200) { 1104 | let body = ''; 1105 | res.on('data', data => (body += data)); 1106 | res.on('end', () => { 1107 | resolve(JSON.parse(body).latest); ^ SyntaxError: JSON Parse error: Unrecognized token 'ߋ' at /tmp/create-react-app@latest--bunx/node_modules/create-react-app/createReactApp.js:1107:22 at endReadableNT (node:stream:2387:52) at processTicksAndRejections (:1:2602) error: "create-react-app" exited with code 1 (SIGHUP) ` The 'Vite freeze' is important, with npm the workaround is to run the bash terminal in vscode, where it becomes interactive, nut but 'bun create vite' freezes in vs code' 'npm create vite' does not freeze in vs code, either in windows or in WSL.

'bun create vite -- --template' in vscode creates a vite project without freezing. 'bun create vite -- --template' in mintty WSL default freezes, the same as in Git Bash for windows.

In summary: $ bun create vite - freezes $ bun create react-app - fails $ bunx create-react-app - fails

$bun create vite -- --template' works in vscode bash terminal. $ bunx create-react-app works in vscode bash

Jarred-Sumner commented 1 year ago

bun create react-app still calls create-react-app and fails:

execa/lib/errname: unable to establish process.binding('uv') 1 | (function (bindingName){"use strict";if(bindingName==="constants")return @p rocessBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue});@throwTypeError(process.binding("${bindingName}");@throwTypeError(%60process.binding(%22$%7BbindingName%7D%22)) is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.`)}) ^ error: process.binding("uv") is not implemented in Bun. Track the status & thumbs up the issue: #2891 at binding (:1:20) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:0 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:128061 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:127427 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:126485 at n (/tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:33779) at /tmp/create-react-app@latest--bunx/node_modules/envinfo/dist/envinfo.js:1:124600

1102 | res => { 1103 | if (res.statusCode === 200) { 1104 | let body = ''; 1105 | res.on('data', data => (body += data)); 1106 | res.on('end', () => { 1107 | resolve(JSON.parse(body).latest); ^ SyntaxError: JSON Parse error: Unrecognized token 'ߋ' at /tmp/create-react-app@latest--bunx/node_modules/create-react-app/createReactApp.js:1107:22 at endReadableNT (node:stream:2387:52) at processTicksAndRejections (:1:2602) error: "create-react-app" exited with code 1 (SIGHUP) ` The 'Vite freeze' is important, with npm the workaround is to run the bash terminal in vscode, where it becomes interactive, nut but 'bun create vite' freezes in vs code' 'npm create vite' does not freeze in vs code, either in windows or in WSL.

'bun create vite -- --template' in vscode creates a vite project without freezing. 'bun create vite -- --template' in mintty WSL default freezes, the same as in Git Bash for windows.

In summary: $ bun create vite - freezes $ bun create react-app - fails

$bun create vite -- --template' works in vscode bash terminal.

This is a separate issue - that something in create-react-app is missing -- and it will be fixed in #5355

essexgit commented 1 year ago

Think you were ahead of my edit @Jarred-Sumner bunx create-react-app works in vscode bash and mintty

neoReuters commented 1 year ago

Also, use Vite, create-react-app is effectively deprecated.

No it isn't. https://github.com/reactjs/react.dev/pull/5487#issuecomment-1409720741

untimated commented 8 months ago

if this does not work in stable way, why bun include this in official guides... I'm new to Bun, and have been experimenting with the bun API's on the server side and see it a a promising true simplified zero cost abstraction of nodejs, however when i decided to delve bit about the frontend setup with bun it did not work. It could be nice in all-in one setup tool if we can entirely uses bunx/bun instead of alternating between bun/npm especially when working fullstack.

image OS: Windows 11 Shell : Developer PowerShell v17.8.0