oven-sh / bun

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

WSL terminal freezing using `bun create` or `bunx` #4664

Closed KirillTregubov closed 1 year ago

KirillTregubov commented 1 year ago

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

Windows version: KB5029263

What steps can reproduce the bug?

  1. Run bunx create-next-app
  2. Skip naming project (press enter)
  3. Try to choose TypeScript (press enter)

OR

  1. Run bun create vite
  2. Skip naming project (press enter)
  3. Try to select Vanilla (press enter)

What is the expected behavior?

(tested with npx/npm, assume bun output is the same)

bunx create-next-app
√ What is your project named? … my-app
√ Would you like to use TypeScript? ... No / Yes
? Would you like to use ESLint? » No / Yes

OR

bun create vite
√ Project name: ... vite-project
√ Select a framework: » Vanilla
? Select a variant: » - Use arrow-keys. Return to submit.
>   TypeScript
    JavaScript

What do you see instead?

bunx create-next-app
✔ What is your project named? … my-app
? Would you like to use TypeScript? › No / Yes

OR

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

Additional information

It seems like interactive CLI prompts make my WSL terminal unresponsive when running scripts using bunx or bun create as opposed to their npx/npm counterparts. The unresponsiveness can be characterized as inability to use input keys (arrows, enter) or exit keys (Ctrl+C). Most notably text prompts work perfectly fine (the first inputs in these scripts).

This seems to be specific to WSL, but I did not test on Linux (tested working on Mac). #4646 seems to have the same issue.

tranlehaiquan commented 1 year ago

For me, I'm create vite it's okay, follow this guide https://bun.sh/guides/ecosystem/vite

image
KirillTregubov commented 1 year ago

For me, I'm create vite it's okay image

Just tested, can confirm it works on my Mac as well. Doesn't work in WSL though.

NicoAvanzDev commented 1 year ago

Figured out the same issue here, tested with WSL and Kali

image

bun v1.0

ksjitendra18 commented 1 year ago

Same issue in Bun 1.0 and Windows 11 and WSL (Ubuntu 22.04)

image

JotunnPy commented 1 year ago

Same issue using bunx create-next-app it freezes on the second question. Windows 11 (WSL, Ubuntu) image

seccentral commented 1 year ago

can confirm on debian 12 and ubuntu 22 locally or remotely via ssh

codebyjon commented 1 year ago

Confirmed as well with Win10, WSL2, Ubuntu v22.

Having this issue across two PC's. Tried reformatting my laptop and reinstalling only WSL + Ubuntu to ensure there was no issues with it reaching to node.

Oddly enough, bunx create-svelte test-app will work, but bunx create-svelte followed by entering the app name does not. bun create svelte also hangs.

Though, on my work PC, bunx create-svelte test-app will allow me to initialize the new app, but bun --bun run dev and bun dev both result in a very similar hang after echoing vite dev.

Other frameworks like bunx create-next-app and bunx create-astro hang as well, irrelevant of whether the project name is supplied as an arg.

EDIT: Just installed Arch WSL to ensure it wasn't the distro and am having the same problems.

ericklarsen commented 1 year ago

Got the same issue here, I tried to create my nextjs app using this command bunx create-next-app and it freezes on the second option too. image

But funny thing is, it works fine when I created svelkit project using bunx command.

sonyarianto commented 1 year ago

maybe related to prompts package? I do like this on my WSL

clone the prompts package and go to the directory

do:

bun example.js (hang on second question) node example.js (success and smooth)

ericklarsen commented 1 year ago

maybe related to prompts package? I do like this on my WSL

clone the prompts package and go to the directory

do:

bun example.js (hang on second question) node example.js (success and smooth)

I have tried it, and it happened the same thing.

ericklarsen commented 1 year ago

Got an idea from @sonyarianto , try to create you nextjs app by using this command (non-interactively) bunx create-next-app <your-project-name> --ts --tailwind --eslint --app --src-dir --use-bun --import-alias "@/*" for more details, you can find it here https://nextjs.org/docs/pages/api-reference/create-next-app#non-interactive

it fixed my problem.

sonyarianto commented 1 year ago

@ericklarsen glad you can solved it, non-interactive to the rescue jaiwakwkakawk

devfakhzan commented 1 year ago

@ericklarsen glad you can solved it, non-interactive to the rescue jaiwakwkakawk

Well, what about other frameworks like Vite for example?

sonyarianto commented 1 year ago

@devfakhzan maybe you can try using non-interactive option during create Vite https://github.com/vitejs/vite/tree/main/packages/create-vite

kopparam commented 1 year ago

Able to reproduce on Ubuntu 22.04.3, amd64.

Thiru-Malai commented 1 year ago

Same issue. Terminal freezes when bun create remix

System: Windows 11

Running using WSL Remotely in VS Code

image

PeterSenpai commented 1 year ago

Same issue.

Command: bunx create-next-app in terminal

System: Windows 10 WSL Ubuntu 22

Elbert-Ainstein commented 1 year ago

just have to manually write all the arguments for creating apps :O

JotunnPy commented 1 year ago

Same problem is also encountered when doing bunx prisma init

aduarterengifo commented 1 year ago

same problem

bun x create-next-app

on wsl

*non-interactive version works fine

hambergerpls commented 1 year ago

I have the same issue with bunx create-next-app. Freezes on second question.

It turns out that this issue arises when node is not installed.

You can verify this by trying it again when node is installed vs not installed. (I'm using nvm)

I'm using WSL Ubuntu 22.04.2 LTS

Apparently, other tools are broken as well when only bun is installed and not node. e.g. bun x vercel build

patbhakta commented 1 year ago

Same issue Win11 - WSL2/Ubuntu 22.04 - Node 18.16.3

bunx create-next-app@latest buntest ✔ Would you like to use TypeScript? … No / Yes ? Would you like to use ESLint? › No / Yes

bunx create-next-app@latest buntest --ts --eslint --tailwind ✔ Would you like to use src/ directory? … No / Yes ? Would you like to use App Router? (recommended) › No / Yes

using strictly CLI s a workaround bunx create-next-app@latest buntest --ts --tailwind --eslint --app --src-dir --use-bun --import-alias a

sudo apt-get install nodejs also fixes it

rraeen commented 1 year ago

use this command bun x create-next-app --ts --tailwind --eslint --app --src-dir --use-bun --import-alias "@/*"

its working for me

artenlf commented 1 year ago

Finally managed to run "bun create vite" command on my WSL 2. Some hints:

Make sure you have installed the latest versions of the following:

  1. Git (v. 2.42.0) (kudos to @iliareshetov )
  2. Node.js LTS (V18.17.1) (kudos to @hambergerpls and @patbhakta )

I think Vite template still uses some of the Node modules so this is the only way. I'm not an expert, so be kind with your messenger, okay?

Tobvl commented 1 year ago

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

Windows version: KB5029263

What steps can reproduce the bug?

  1. Run bunx create-next-app
  2. Skip naming project (press enter)
  3. Try to choose TypeScript (press enter)

OR

  1. Run bun create vite
  2. Skip naming project (press enter)
  3. Try to select Vanilla (press enter)

What is the expected behavior?

(tested with npx/npm, assume bun output is the same)

bunx create-next-app
√ What is your project named? … my-app
√ Would you like to use TypeScript? ... No / Yes
? Would you like to use ESLint? » No / Yes

OR

bun create vite
√ Project name: ... vite-project
√ Select a framework: » Vanilla
? Select a variant: » - Use arrow-keys. Return to submit.
>   TypeScript
    JavaScript

What do you see instead?

bunx create-next-app
✔ What is your project named? … my-app
? Would you like to use TypeScript? › No / Yes

OR

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

Additional information

It seems like interactive CLI prompts make my WSL terminal unresponsive when running scripts using bunx or bun create as opposed to their npx/npm counterparts. The unresponsiveness can be characterized as inability to use input keys (arrows, enter) or exit keys (Ctrl+C). Most notably text prompts work perfectly fine (the first inputs in these scripts).

This seems to be specific to WSL, but I did not test on Linux (tested working on Mac). #4646 seems to have the same issue.

Having the same issue Ubuntu 22.04 freshly installed using Microsoft's WSL installation guide Freezes when selecting a variant

Captura de pantalla 2023-09-12 025844
vmxt commented 1 year ago

The same thing. not working on wsl. (debian) I got up in this section only because the runtime's behavior was hung.

: 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
ShimiShimson commented 1 year ago

Confirmed on win10 wsl ubuntu

theebestzz commented 1 year ago

~/next-js$ bun Bun: a fast JavaScript runtime, package manager, bundler and test runner. (1.0.1)

run ./my-script.ts Run JavaScript with Bun, a package.json script, or a bin test Run unit tests with Bun x next Install and execute a package bin (bunx) repl Start a REPL session with Bun

init Start an empty Bun project from a blank template create next-app Create a new project from a template (bun c)

install Install dependencies for a package.json (bun i) add hono Add a dependency to package.json (bun a) remove moment Remove a dependency from package.json (bun rm) update react Update outdated dependencies & save to package.json link Link an npm package globally unlink Globally unlink an npm package pm More commands for managing packages

build ./a.ts ./b.jsx Bundle TypeScript & JavaScript into a single file

upgrade Get the latest version of Bun bun --help Show all supported flags and commands

Learn more about Bun: https://bun.sh/docs Join our Discord community: https://bun.sh/discord

~/next-js$ bun create next-app /mnt/c/Users/femin/AppData/Roaming/npm/node_modules/node/bin/node: 1: This: not found error: "create-next-app" exited with code 127

AppData/Roaming/npm/node_modules/node/bin/node: 1: This: not found error: "create-next-app" exited with code 127

I get a direct error

Windows 10 - wsl

Virtute90 commented 1 year ago

For Vitejs, using scafolding works correct on Ubuntu server 22.04 on VM

image

https://vitejs.dev/guide/#scaffolding-your-first-vite-project

vmxt commented 1 year ago

For Vitejs, using scafolding works correct on Ubuntu server 22.04 on VM

image

https://vitejs.dev/guide/#scaffolding-your-first-vite-project

Yea, this one works but, by using pnpm it doesn't work.

MaKTaiL commented 1 year ago

I fixed this by installing Node inside the WSL environment. Don't ask me how this is related to Bun, but it worked!

image

JohnC0de commented 1 year ago

Woks here, unsing win 11 LTS, with WSL2 Ubuntu 22.04.3 LTS, using NVM to install latest node(v20.6.1), bun 1.0.1!

image image

It seems like when using commands such as bun create vite or the equivalent for next, the process might be relying on the Node engine to generate the template. If Node/npm isn't properly installed or configured in win/wsl, this could potentially lead to issues. Additionally, I've noticed that when trying to run bunx --bun create-vite to possibly utilize the bun engine during template creation on my machine, there seems to happen the same issu, it freezes.

executionreverted commented 1 year ago

i could create svelte project after installing node js 18.x and git ,

but hot reload does not work.

sonyarianto commented 1 year ago

WOW, the latest version v1.0.2 seems to solved this problem (at least on my machine).

ohthepain commented 1 year ago

bun upgrade to 1.0.2 and you should be good to go. The react template has been deprecated but it will walk you through the new template.

KirillTregubov commented 1 year ago

Can confirm that bun upgrade to 1.0.2 resolves the issues. Thanks to everyone who contributed their input and experiences! I will be closing this.

emircanerkul commented 1 year ago

@KirillTregubov I'm using the latest one and I'm using the ubuntu container, had the same problem. Can't continue

image
MaKTaiL commented 1 year ago

@KirillTregubov I'm using the latest one and I'm using the ubuntu container, had the same problem. Can't continue

image

Use nvm to install node in the Ubuntu container and give it another try.

emircanerkul commented 1 year ago

@MaKTaiL thank you, it is solved via installing nvm and node.

Levent0z commented 1 year ago

I believe this has something to do with bun and/or inquirer. My code works well when building with bun using --target=node and running the outfile with Node. When I build with bun and --target=bun and then run with bun, it freezes after a few prompts.

macOS 13.6, node 18.7.1, bun 1.0.5, inquirer 9.2.11

Levent0z commented 1 year ago

Added repro on https://github.com/oven-sh/bun/issues/6323

pablodz commented 10 months ago

Same issue using bunx create-next-app it freezes on the second question. Windows 11 (WSL, Ubuntu) image

same happening now to me, even on linux native, I don't have installed npm or nodejs

ekiwi111 commented 10 months ago

Same happening to me: node -v: v18.19.0 or v20.10.0 bun -v: 1.0.15

stuck on 2nd question while installing next.js in bun monorepo packages: screen recording.webm

pablodz commented 10 months ago

Fixed using this command

# bun
bunx create-vite my-vue-app --template vue

from docs https://vitejs.dev/guide/#scaffolding-your-first-vite-project

giroberto commented 10 months ago
$ bun create vite test-app
? Select a framework:
 › - Use arrow-keys. Return to submit.
❯ Vanilla
   Vue
   React
   Preact

Here it's as simple as that, if I have node installed on linux, I can select the options with the arrow keys and the enter key, and if I don't have node the command crashes and I can't even close it with CTRL+C.

jjwallace commented 10 months ago

image

Stuck, Node 20.10.0 bun 1.0.15 npm 10.2.3

ubuntu

Jarred-Sumner commented 10 months ago

image

Stuck, Node 20.10.0 bun 1.0.15 npm 10.2.3

ubuntu

@jjwallace please upgrade to Bun v1.0.18 by running bun upgrade

giroberto commented 10 months ago

image Stuck, Node 20.10.0 bun 1.0.15 npm 10.2.3 ubuntu

@jjwallace please upgrade to Bun v1.0.18 by running bun upgrade

I tested it again and now it's working. Node no longer needs to be installed on wsl.