Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bun Not Found After Running Installation Script

Tags:

bun

I have ran the installation script by pasting this code:

$ curl https://bun.sh/install | bash

However, when I try to get the version of bun, it says it could not find it:

$ bun --version

Command 'bun' not found, did you mean:

  command 'ben' from deb ben (0.9.0ubuntu2)
  command 'bus' from deb atm-tools (1:2.5.1-4)
  command 'zun' from deb python3-zunclient (4.0.0-0ubuntu1)

Try: sudo apt install <deb name>
like image 533
sno2 Avatar asked Dec 01 '25 21:12

sno2


1 Answers

I had the same issue running on Windows 10 WSL2 Ubuntu-22.04 with Bun v0.1.5.

The solution (and more detail just in case anyone needs it) below:

The executable for bun is in the directory /home/username/.bun. You need to add this to your $PATH so that this can be found when typing bun commands such as bun --help.

The bun setup process does not add this path so you need to do it yourself.

Two ways to do this :

(1) Manual method

Type in the terminal:

export BUN_INSTALL="/home/YOUR_USERNAME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"

Replacing YOUR_USERNAME with your real username (the current username can be found by typing 'whoami' in the terminal).

Note: This process will have to be repeated for every new shell you open.

(2) Automatic method

Edit the .bashrc file :

nano ~/.bashrc 

at the end of this file add

BUN_INSTALL="/home/YOUR_USERNAME/.bun"
PATH="$BUN_INSTALL/bin:$PATH"

Replacing YOUR_USERNAME with your real username (the current username can be found by typing 'whoami' in the terminal).

(Remember to save your changes with Ctrl-O.)

Note: You will need to open a new shell for this to work OR type source ~/.bashrc to use in the current terminal.

You should now be able to run bun commands in any new shell.

like image 190
piyook Avatar answered Dec 05 '25 03:12

piyook



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!