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>
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.
The installation script says a message at the end telling you how to add bun to your PATH manually. Here is that output:
Manually add the directory to your $HOME/.bashrc (or similar)
BUN_INSTALL="/home/sno2/.bun"
PATH="$BUN_INSTALL/bin:$PATH"
I advise you re-run the installation command and copy the environment variables and add them to your PATH.
export BUN_INSTALL="/Users/manendra/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
add these to your .bashrc, .zshrc or you can use export command to use for current session.
Note: Change your username place of (manendra) "/Users/manendra/.bun"
Manually add the directory to ~/.bashrc (or similar):
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
From the installer, last message is:
To get started, run
exec /bin/zsh
bun --help
Related
On Windows 10 Pro and 11 Pro I have installed and activated Ubuntu-20.04 and Debian. Using the documentation from MS on switching those distros to a secondary drive, everything seemed to work fine. Until the WSL import command. It outputs "Access is denied". I've tried Windows Terminal, PowerShell, and even WebStorm; I get the same output.
I am running with elevated privileges but to no avail. The export works fine, I use a different name as the source file to ensure I restore the name to its original name. The wsl.conf editing looks good, everything lines up... until the import command.
I am at a loss. I've exhausted all research. Can anyone help me resolve this so I can run these from my F: drive?
Cheers,
RN
You just have to put a filename in the end, like:
wsl --export Ubuntu C:\Users\Desktop\OneDrive\Documents\ubuntu.tar
Suppose you want to import an exported distribution "ubuntu.tar".
Try to cd at the location of the .tar file before executing the wsl --import command in PowerShell (running as standard user), for example:
PS X:\> cd D:\
PS D:\> wsl --import Ubuntu_copy .\Ubuntu_copy ubuntu.tar
Executing the wsl --import command with an absolute path didn't work for me, but the above mentioned method did.
Just in case this is an ongoing issue for anyone, you need to run wsl --import not just from an Administrator account, but you need to run Powershell/cmd as Administrator, for example by right-clicking a pwsh.exe icon/shortcut and clicking "Run as administrator". If you're running as a standard user and "Run as administrator", the import will install the distro for the admin user you've chosen to run as.
The full syntax is:
wsl --import <Distro name> <Install folder> <Source .tar file>
The import syntax is as following, you should be carefull about install dir and imported tar file's arguments order:
--import <Distro> <InstallLocation> <FileName> [Options]
Imports the specified tar file as a new distribution.
The filename can be - for standard input.
Options:
--version <Version>
Specifies the version to use for the new distribution.
I've installed Cloud SDK on my windows 10 machine and I'm able to run commands like "gcloud", "gsutil" and "bq" on my command prompt. However, when I run "gsutil" or "bq" on Bash, this is the error I'm getting.
$ bq
bash: bq: command not found
Then I added this location to PATH C:\Users\User\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin, and afterwards I seem to be able to call gsutil and bq using gsutil.cmd and bq.cmd. But of course, I'd prefer calling bq / gsutil directly.
Has anyone has this problem before? Thank you!
I found one possible solution!
In Bash, go to the root bash folder by typing cd
Type touch .bashrc
write alias bq="bq.cmd" or alias gsutil="gsutil.cmd" or both
Press Esc and type :qa and Enter to save and exit
This tells Bash to remember bq as invoking bq.cmd, hence now I can invoke bq anywhere -- as far as I know.
If anyone has a better suggestion, please let me know! Thank you!
In the bash session itself, check what echo $PATH returns. It should inherit the path that was defined on Windows.
So open a new CMD session, and:
make sure the %PATH% does include C:\Users\User\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin,
then call C:\path\to\Git\bin\bash.exe to open a bash session
bq should work in such a shell session.
When I want to make some commands in Visual Studio Code terminal, it prints a message like this:
command 'lesspipe' is available in the following places
This also happens with dircolors. If I want to do something with git or sudo or some other command, it won't let me.
The text is in spanish.
command 'lesspipe' is available in the following places
* /bin/lesspipe
* /usr/bin/lesspipe
command not found because <</usr/bin:/bin> is not include in path variable.
I am assuming that you configured Visual Studio Code to use the default shell on Linux:
With that said and based on the error, it seems that there's something in your .bashrc (or .bash_profile) that messed up your PATH environment variable, something that removed /usr/bin and /bin from it. For example, if I put this some invalid commands at the end of my .bashrc:
/usr/bin/commandthatdoesnotexist
When I open a Terminal on VSCode, those errors will display like this:
bash: /usr/bin/commandthatdoesnotexist: No such file or directory
I suggest you check your .bashrc. I don't know exactly what you added to it so I can't reproduce your problem. Check if you modified the PATH environment variable (did you re-define it? did you accidentally exported it incorrectly?). If you did, temporarily remove those changes.
On an actual terminal (outside of VSCode), you can try to do the following:
$ echo $PATH
# Should display something like this:
# /home/gino/bin:/home/gino/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
If PATH is not like that:
$ export PATH=$PATH:/usr/bin:/bin
$ sudo vim /etc/environment # or sudo nano or sudo vi, whichever you use
Then edit PATH to look something like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
Then try the terminal on VSCode again. If it's working now, re-check your modifications on .bashrc to see which one is causing the problem.
I would suggest to logout of root
run
$ sudo nano /etc/environment
replace the path by
$ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr>
I'm using Mac Lion. I was using mongodb version 1.4. I wanted to upgrade to 1.8.5 and I followed http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x step wise replacing each mongodb-osx-x86_64-1.4.0 by mongodb-osx-x86_64-1.8.5. Everything goes smooth. I tried:
mongod
it's ok. I can access localhost:28017
but,
mongo
shows command not found
How can I fix this?
You need to add the path to "mongo" to your terminal shell.
export PATH=$PATH:/usr/local/mongodb/bin
Did you do the last step with paths.d? If so, try restarting your terminals.
Do you have a good reason for using 1.8.5? The current stable is 2.0.4, and it has many useful upgrades from 1.8.x
Starting from Mongodb version 6.0 mongo was replaced by mongosh
For readers in 2021:
export PATH="$PATH:/usr/local/opt/mongodb-community#3.6/bin"
You'll have to add the location of the Mongo binary to PATH.
Follow the steps below in order to make the PATH variable permanent:
Open Terminal and navigate to your user directory.
Run touch ~/.bash_profile and then open ~/.bash_profile.
In TextEdit, add export PATH="<mongo-directory>/bin:$PATH" (Keep the quote marks - related to white spaces).
Save the .bash_profile file and Quit (Command + Q) Text Edit.
Run source ~/.bash_profile.
Run echo $PATH and check if the you see that the Mongo binary was added.
(*) Notice that the PATH variable is now available only for the current terminal and not to processes that were already started in the session.
In order to make it available outside the current terminal - you'll have to logout and login.
1.Go to your [mongodb installation dir]:
cd <mongodb installation dir>
2.Type ./bin/mongo to start mongo:
./bin/mongo
Read More
Note :
If above command gives error
Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_ environment variables are set correctly.*
Run bellow command: Read More
export LC_ALL=C
How can find installation directory
find / -name "mongodb"
You can also set path
export PATH=$PATH:<mongodb installation dir>/bin
documentation
export PATH={mongodb-install-directory}/bin:$PATH
In Mac:
Go into Bash Profile:
vi ~/.bash_profile
Add Path of Installation of MongoDB:
export PATH=$PATH:/usr/local/opt/mongodb-community#4.2/bin
Reload the Bash Profile:
source ~/.bash_profile
You can navigate to the mongo directory using the command line and then start MongoDB with
./mongodb
I was facing the same problem this worked for me.
you need to install mongodb shell to ge the mongo command working.
Download link
I didn't have the right mongo command line tools installed. This from Brew worked for me though.
brew install mongodb-community
just a little recommandation, if your path has a space just wrap the whole path with quote or doublequote
example : C:\Program Files\MongoDB\Server\4.2 . notice the space in "Program Files"
export PATH=$PATH:"C:/Program Files/MongoDB/Server/X.X/bin"
in place of mongo command use mongosh command and it will work.
I'm using Mac Lion. I was using mongodb version 1.4. I wanted to upgrade to 1.8.5 and I followed http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x step wise replacing each mongodb-osx-x86_64-1.4.0 by mongodb-osx-x86_64-1.8.5. Everything goes smooth. I tried:
mongod
it's ok. I can access localhost:28017
but,
mongo
shows command not found
How can I fix this?
You need to add the path to "mongo" to your terminal shell.
export PATH=$PATH:/usr/local/mongodb/bin
Did you do the last step with paths.d? If so, try restarting your terminals.
Do you have a good reason for using 1.8.5? The current stable is 2.0.4, and it has many useful upgrades from 1.8.x
Starting from Mongodb version 6.0 mongo was replaced by mongosh
For readers in 2021:
export PATH="$PATH:/usr/local/opt/mongodb-community#3.6/bin"
You'll have to add the location of the Mongo binary to PATH.
Follow the steps below in order to make the PATH variable permanent:
Open Terminal and navigate to your user directory.
Run touch ~/.bash_profile and then open ~/.bash_profile.
In TextEdit, add export PATH="<mongo-directory>/bin:$PATH" (Keep the quote marks - related to white spaces).
Save the .bash_profile file and Quit (Command + Q) Text Edit.
Run source ~/.bash_profile.
Run echo $PATH and check if the you see that the Mongo binary was added.
(*) Notice that the PATH variable is now available only for the current terminal and not to processes that were already started in the session.
In order to make it available outside the current terminal - you'll have to logout and login.
1.Go to your [mongodb installation dir]:
cd <mongodb installation dir>
2.Type ./bin/mongo to start mongo:
./bin/mongo
Read More
Note :
If above command gives error
Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_ environment variables are set correctly.*
Run bellow command: Read More
export LC_ALL=C
How can find installation directory
find / -name "mongodb"
You can also set path
export PATH=$PATH:<mongodb installation dir>/bin
documentation
export PATH={mongodb-install-directory}/bin:$PATH
In Mac:
Go into Bash Profile:
vi ~/.bash_profile
Add Path of Installation of MongoDB:
export PATH=$PATH:/usr/local/opt/mongodb-community#4.2/bin
Reload the Bash Profile:
source ~/.bash_profile
You can navigate to the mongo directory using the command line and then start MongoDB with
./mongodb
I was facing the same problem this worked for me.
you need to install mongodb shell to ge the mongo command working.
Download link
I didn't have the right mongo command line tools installed. This from Brew worked for me though.
brew install mongodb-community
just a little recommandation, if your path has a space just wrap the whole path with quote or doublequote
example : C:\Program Files\MongoDB\Server\4.2 . notice the space in "Program Files"
export PATH=$PATH:"C:/Program Files/MongoDB/Server/X.X/bin"
in place of mongo command use mongosh command and it will work.