I'm using the most recent VScode on Ubuntu 22.10 and experiencing the following issues while opening ZSH and BASH shells in the integrated terminal. The standard Ubuntu terminal works without errors.
After starting a ZSH integrated terminal:
compdump:138: command not found: mv
/home/user/.oh-my-zsh/oh-my-zsh.sh:56: command not found: mkdir
/home/user/.oh-my-zsh/tools/check_for_upgrade.sh:29: command not found: git
/home/user/.oh-my-zsh/oh-my-zsh.sh:115: command not found: rm
getent:6: command not found: grep
_p9k_init_cacheable:59: command not found: uname
_p9k_init_cacheable:61: command not found: uname
BASH
Command 'uname' is available in the following places
* /bin/uname
* /usr/bin/uname
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
uname: command not found
Just several hours before, it worked just fine. Then I tried to set up Remote SSH to another Linux machine (Fedora 36, with the same sort of errors I was also unable to resolve by googling).
Using the #modified keyword in Settings, I ensured that no unexpected changes had been made. The PATH is the same as in the fully operational standard terminal.
Wondering what could be the issue.
UPDATES.
PATH variable:
/usr/local/cuda-11.7/bin:/home/user/.conda/envs/env/bin:$PATH
The problem.
Unlike the complete PATH expansion in the standard terminal, PATH was expanded partially (omitting /usr/bin, etc.) in the integrated terminal.
Based on this error,
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
I suggest you run,
export PATH="/usr/bin:$PATH"
To add /bin:/usr/bin to your PATH
Having :$PATH in your PATH means that the sheell will add the variable $PATH to the end of your PATH
The cause of the issue the following configuration from the User settings:
terminal.integrated.env.linux": {
"PYTHONPATH": "/media/user:/media/user/common:$PYTHONPATH",
"PATH": "/media/user:/media/user/common:$PATH"
}
While the PYTHONPATH variable is expanded properly in the integrated terminal, the PATH is expanded partially to something shown in the UPDATES section of the question. To build on top of the answer by #Orion447, looking for any potential place where PATH could get corrupted is the approach that likely solves the problem.
Related
Chances are that you might be getting the following error on your Mac, when you have been trying to run commands in the terminal
and you have already installed the commands
zsh: command not found: git
or
zsh: command not found: curl
The fix is in the answer below
Chances are that something might have gone wrong with the users $PATH on your machine or maybe the actual path where the command is has not been set.
You can just run the command below, this should fix you issue:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
and if you feel like checking the path you can just run :
echo $PATH
edit : I ended up upgrading to macOS Catalina yesterday and replacing bash with zsh. One thing that should be noted is that the stackcommand worked previously, but despite all the tinkering not ghci
After deleting all the files that had anything to do with Haskell, I retried running curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
This second time there was an error with the command line tools so I had to install them manually with xcode-select --install. After rerunning the curl, I added the path to the environmental file to my zsh profile manually with :
. "$HOME/.ghcup/env"\
echo '. $HOME/.ghcup/env' >> "$HOME/.zshrc"
Here is the content of the env file :export PATH="$HOME/.cabal/bin:/Users/agnel/.ghcup/bin:$PATH"
Now everything seems to be working (I never reinstalled stack, but I think I might leave that to the side while I learn the basics of the language).
I installed the Haskell Platform yesterday but am having a hard time getting it to work correctly.
The firsts steps I did are:
curl -sSL https://get.haskellstack.org/ | sh
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
On step 1. the instructions said to append /Users/.../.local/bin the PATH variable (which I did in /etc/paths. On step 2, the script was supposed to pop up a dialog box (and didn't) when installing the necessary command line tools. It also said to rerun the script once complete (which I did). The script also said I should adjust my PATH variable, and source /Users/.../.ghcup/env in my shell configuration. It asked to this automatically but failed having not found the ~/.bashrc File. (I read that on Mac in contrary to linux, only .bash_profile is loaded upon opening of a terminal window so I adjusted the path variable there manually. I've spent forever messing around with the path variables and every time I try and run "$ ghci" I get the same -bash: ghci: command not found error message. If anyone has a solution to this problem I would be very grateful for an answer. If not, could someone with a working distribution of Haskell on their computer show me what their path variables look like?
Thanks!
A simple solution would just be to restart your terminal and you are good to go.
After installing the Haskell platform for the first time on a new mac with Catalina, I also got
~> ghci
zsh: command not found: ghci
What worked in my case was to use, instead of the plain ghci,
stack ghci
To get back the familiar behaviour, I created in my homedirectory a file named .zshrc containing
alias ghci='stack ghci'
If you open a new terminal, this file will automatically be executed.
I'd be interested to know if there is another solution.
Check if the ghcup command is working or not.
If not, make sure the .zshrc file has command for execution of ghcup. It should look something like this -
[ -f "/Users/myusername/.ghcup/env" ] && source "/Users/myusername/.ghcup/env" # ghcup-env
If the file exists, simply restarting terminal will work.
If it is still not working, set GHC as default using ghcup - follow this
for some reason whenever I open my terminal it immediately prints the following (after the "last login" line of course):
(eval):116: command not found: dirname
(eval):116: command not found: dirname
__add_sys_prefix_to_path:6: command not found: dirname
__add_sys_prefix_to_path:7: command not found: dirname
It appears that terminal still works fine, but I can't seem to figure out what the cause of these errors could be. The only thing I've "changed" in my terminal last time I used it was setting up a conda environment and installing some new packages.
Any ideas?
You have tampered with the PATH variable and your current PATH cannot figure out where your common utilities are located.
try:
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
Fix the last entry you made in your bash_profile or zshrc file before you started encountering the error.
A majority of terminal commands don't work, for example .
ls
sudo
vi
with the error -bash: ls: command not found my path is echo $PATH
“/Users/username/usr/local/bin I get the feeling that “ should not be there but not sure how edit it.
What should the path be and how do I get the path to stay the same?
You need to add more paths to your $PATH variable. Try running whereis ls and check where is the binary of the command.
You can add more paths like this: export PATH=$PATH:NEW_PATH
I had a similar experience recently where a lot of my terminal commands were not being found despite being clearly saved in my bash_profile. After lengthy process of elimination I realised that the issue was caused when I tried to export a new path. The error that I had made was putting a space in the command. So I had to change
export SOMETHING = /path/to/something.apk to
export SOMETHING=/path/to/something.apk
So I would recommend you check all your path declarations to ensure you don't have any white spaces. Also don't forget to source your bash_profile or what ever type of command line shell you use.
I'm using Windows XP with the latest version of Cygwin. If I set the following environment variable in my Windows system
JBOSS_HOME=C:/Program Files/jboss-4.2.3.GA
and then fire up Cygwin, I'm unable to switch to the inherited $JBOSS_HOME directory.
$ cd $JBOSS_HOME
cygwin warning:
MS-DOS style path detected: C:/Program
Preferred POSIX equivalent is: /cygdrive/c/Program
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
-bash: cd: C:/Program: No such file or directory
Is it possible to define my system variable once in the Windows environment and then get Cygwin to interpret it so that I don't get this "No such file or directory" warning?
You could do one of two things...
Add a command to convert the path in your .bashrc file, like so...
export JBOSS_HOME=$( cygpath "$JBOSS_HOME" )
or
Just put the variable between quotes when referencing it, since Cygwin understands DOS style paths, even though it doesn't prefer them. The reason the command is failing for you is that there is a space in the path, so putting it in quotes will get the path to be read correctly as one arg...
cd "$JBOSS_HOME"
Note that you might still get that same "cygwin warning" in this case. In order to make that go away, you need to add nodosfilewarning to your CYGWIN var as the warning advises. You can do that by adding this in your .bashrc file...
export CYGWIN="${CYGWIN} nodosfilewarning"
I am using Eclispse with ShellED plugins,
I got the same notification, not knowing the accurate configuration,
I just add the export value into the script
'#!/bin/bash'
export CYGWIN="${CYGWIN} nodosfilewarning"
echo hello
This works for me
$ SEVENZIP="C:/Program Files/7-Zip"
$ read < <(cd "$SEVENZIP"; pwd)
$ cd "$REPLY"