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>
Related
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
I have this message whenenver i try to type code .
Can someone help me please ?
Thanks in advance
Fixed it
Open VS Code on Windows
Open Extensions and then search on WSL
It should say the extension needs to be reloaded - go ahead and reload it
Open WSL and type code
This should force another upgrade of code and this time it should launch.
I just now had the same issue on WSL2 Kali. I tried everything given here: https://github.com/microsoft/vscode-remote-release/issues/2962.
My problem was VS Code was not on Kali's path. Here's how I fixed it :)
echo $PATH
# Confirm PATH is missing this:
/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/
# Confirm VS Code's location then export:
export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"
# It's temporarily added to path...
echo $PATH
# This should now trigger VS Code Server install,
# then open ~/ in VS Code.
code .
# If above works, make it permanent:
echo 'export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"' >> ~/.bashrc
# Restart shell + test
exec "$SHELL"
code .
I solved this problem by opening windows powershell in admin mode and typing the following command:
wsl --update
Then I typed this command to force restart the WSL and all done
wsl --shutdown
I have same issue when I trying export my old wsl and move whole project to nvme ssd using new distro.
I able to run the code . on root , but when i switch to my name then it doesn't work, I guess is WSL PATH problem.
I not really familiar to the linux, the below image may easier for you to understand what i am saying.
When i use echo $PATH on wsl to compare root and my account, and i notice that VS code directory only found on root instead of my account.
So i use export PATH=$PATH:"/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft VS Code/bin" to add the VS Code path to my account* and code . is working once i export this.
But the code . will not be able to run again if you restart the wsl, so we need to put in to bashrc.
But when i try to update my account's* PATH using
echo "PATH=$PATH:/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft\ VS\ Code/bin" >> ~/.bashrc and restart the wsl to login my account, i notice an error msg popup when run the code .
cannot create /tmp/remote-wsl-loc.txt: Permission denied
And i found this.
https://github.com/microsoft/vscode-remote-release/issues/5389
Seem they only giving the workaround for now and hopefully can fix it soon.
*disclaimer above: this code need to run under your account instead of root
**For editing bashrc, instead of using echo and >> write to the file, you also can use code ~/.bashrc to update/edit, when you have the vscode access on wsl.
This also happens if you disable the Windows PATH on WSL. I had my VS Code working fine, then when I disable the windows PATH (by editing/creating the /etc/wsl.conf file and inserting the [interop] appendWindowsPath = false parameter) the code command stopped working.
The ek1n8 solution solves my problem, addind the export manually to the WSL Path:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me adding the binary to Path was enough:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me it was wsl using the wrong container:
wsl --list -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu Running 2
I did wsl -s ubuntu
wsl --list -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Stopped 2
and it solved the problem
I have been trying to pip install psycopg2 for some time now
I have just updated to python 3.7.4, before this problem started.
To set my path to a specific python version I used the code below.
nano .bash_profile
I thought that it would now be easy for my system to identify the path of the newly installed python, as to enable it to install psycopg2. Then the below started happening.
The second line of system terminal or python terminal is now always showing:
-bash: zzzzz#: command not found on my terminal
No matter what I type on my terminal, I am always getting command not found
This would mean you literally have "zzzzz" somewhere in the bash_profile. Bash is seeing "zzzzz" as just another command to run at startup like the rest of the profile script. As there is nothing in your PATH matching that string, bash reports the issue back to you.
Either remove the extra line from your .bash_profile. OR use a terribly wasteful work-around!
ln -s /bin/true /bin/zzzzz
This will create a symbolic link to the "true" binary (all it ever does is return true) from zzzzz. Now bash can find zzzzz and run it during start up, which does nothing. No more error and an absurd work around. You should fix the file.
I'm trying to set up a CoffeeScript build system in Sublime Text 3, but I keep getting the following error:
env: node: No such file or directory
[Finished in 0.0s with exit code 127]
[cmd: ['coffee', '-o','/Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/script', '-cw', '/Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/coffee']]
[dir: /Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/coffee]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
My build system looks like this:
{
"name": "Coffee - AT",
"cmd": ["coffee","-o","${project_path:${folder}}/static/script","-cw","${project_path:${folder}}/static/coffee"],
"selector": "source.coffee",
"path":"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib/node_modules/coffee-script/bin"
}
Two things strange about this.
1) It says it's looking in /usr/bin where a symlink to coffee exists.
2) Because of (1), I overrode $PATH to include the actual location of coffee which is /usr/local/lib/node_modules/coffee-script/bin, but for some reason, $PATH isn't being overridden properly, it's sticking with the default $PATH.
Things to note:
i) I've verified that all paths are correct and pass normally through a regular terminal command.
ii) Tried with a "shell": true variable in the build system.
iii) I have another build system for Compass like this that works fine.
Anyone run into similar problems or issues? Any ideas?
In Terminal, type which node, then create a symlink to that location in /usr/bin. For example, if node lives in /usr/local/bin, create the symlink like so:
sudo ln -s /usr/local/bin/node /usr/bin/node
If you look at the source of your coffee script, you'll probably find that the first line is something along the lines of:
#!/usr/bin/env node
Exit code 127 in Sublime means that an env command has failed - so in your case, the build system is finding coffee, but it can't execute it because the node binary isn't in Sublime's default search path.
There are two ways to redefine the default search path for Sublime. The first (and easiest) is to always open it from the command line using the built-in subl command. If you're an OS X power user and don't mind messing with important system settings, check out my post on unix.SE on how to alter the default /usr/bin:/bin:/usr/sbin:/sbin path that you're seeing. Be forewarned that if you don't do things correctly, you may break your system. However, if you're running Mountain Lion (10.8.X) and you follow the instructions exactly, everything should be fine. (I haven't upgraded to Mavericks, so no guarantees on whether it'll work with that version.)
How to solve the problem under an Ubuntu System
The fact is "coffee" command will call /usr/bin/node to continue its work, however, the original "node" command for the node application on an Ubuntu system is changed from "node" to "nodejs" to avoid name conflicting. That is the reason, the shell will compliant you "/usr/bin/env: node: No such file or directory". whenever you type
$ coffee
To solve the bug, just let the shell find something named "node" in its default searching path, and this so-called "node" will promote nodejs. The command "nodejs" lies under path of /usr/bin/nodejs.
We will use symbol link to link "node" with nodejs, and place the link "node" within the default searching path, so that the shell will find it.
sudo ln -s /usr/bin/nodejs /usr/bin/node
But beware, make sure that you do NOT have another "node" command under /usr/bin/, you can check it by try to run
$ which node
I do NOT know what to do if you have installed another "node" application.
In Ubuntu you can install the package nodejs-legacy
sudo apt-get install nodejs-legacy
this package just create a symbolic link to binary nodejs
You should be able to fix this all in your build system without needing to add a symlink on your machine.
For example if node lives in /usr/local/bin/node all you have to do is change the path in your build_system to be:
"path": "/usr/local/bin:$PATH"
I had the same problem with Sublime Text 2.
Creating this sublime build worked for me:
{
"cmd": ["coffee", "-c", "$file"],
"selector" : "source.coffee",
"path" : "/usr/local/lib/node_modules/coffee-script/bin/:/usr/local/bin:$PATH"
}
The following code worked for me in Ubuntu 14.04:
**$ sudo apt-get install NodeJS-legacy**
The other problem was the version checking frameworks such as for e.g: gulp -v the same code also solved this problem.
Type the next in the console:
sudo ln -s /usr/bin/nodejs /usr/bin/node
I am using a vpn service from certain server. I was given with a root account, and when I connect with a root account, the command line looks like below.
root#xa9g82:/etc/#
Then I used useradd to add an account called 'temp'
When I connected to the server with temp, then the command line only has a single character.
$
The user information is not shown, neither the path. Also, note that, in root's command line I can use tab to automatically complete the filename, however 'temp's command line inserts tab space, when I press tab. It is very inconvenient.
I am using Ubuntu 10.04. How can I resolve this issue?
I usually edit ~/.bashrc. Being root, you might want to change the system-wide preferences, at /etc/bash.bashrc. Personally, I changed some lines in ~/.bashrc to look like:-
# If this is an xterm set the title to user#host:dir
case "$TERM" in
xterm*|rxvt*)
## PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u#\h: \w\a\]$PS1" # default
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\h: \W\a\]$PS1" # How I like it
;;
*)
;;
esac
use prompt to set the prompt.... (man prompt...)
it depends on what shell you run each one has it's own tricks, but you can make it looks as you wish.
BASH
TCSH
It is likely that the default shell for root is set to /bin/sh, which does not provide many of the features that you may used to if you use a shell like bash. To check if this is the case, run the following command:
cat /etc/passwd | grep ^root
The last component of the line that this command outputs will be your shell (which, as stated previously, I'm guessing is /bin/sh). If this is not the shell you want (it probably isn't), then edit /etc/passwd (using nano or whatever editor you're most comfortable with) and change your shell to something more palatable, like /bin/bash. After doing this, you'll need to log out and then log back in.