Command can't be found in zsh on windows - windows

I'm trying to complete configuration of zsh. When I run commands in git-bash, it's OK. However, the error "zsh: command not fount" is reported when I run these commands in zsh itself. Then I check the file ".zshrc" and find the path exported may get wrong.
export PATH=$HOME/bin:/usr/local/bin:$PATH
These files are located in another directory but not in "$HOME". But I don't know how to alter the line.

Related

zsh: command not found on MacOS Monterey

I wanted to create a react project and when I executed the command it said zsh: command not found: npx
Then I tried the ls command and it said zsh: command not found: ls.
After setting the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command both the ls and npx create-react-app command worked fine and when close the terminal and reopen again, the same command not found error shows.
Is there any permenent fix without setting export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command
For adding the variables to the path you need to add it to zshrc file for making that variable available locally.
The way you have used will only work until you use it in the same terminal window path only.
To solve the problem, follow these steps:
Goto you home directory
Simultaneously press cmd + shift + (.) Note:the last key is the key of dot
On following step 2, new hidden files will appear in home directory, look for (.zshrc) file and open it using any text editor.
Add your path variable in it, save and then close it.
Example: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Open terminal and run the command: "echo $PATH" and see if your added variable is present in the output shown by terminal.
If yes, You are now ready to go to use it from anywhere in terminal now.
This is what worked for me on macOS Monterey,
Although I added the path to ./zshrc and sourced the file, after reopening the terminal the PATH was not exported
I followed these steps to solve this
Created .zprofile with touch .zprofile at the home directory. If the file already exists use that.
Add the required path to this file using vim or nano
eg: export PATH=${PATH}:/Users/Development/HashBaze/flutter/bin
If the above two steps don't work try sourcing both the .zprofile and .zshrc after following the above two steps.
This solution worked for me on macOS Monterey version 12.5

no such file or directory at share folder

When I start bash, the following description appears:
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
i'm using Microsoft-Windows-Subsystem-Linux, with ubuntu distro.
I already tried uninstalling by powershell pip uninstall virtualenvwrapper or in bash sudo pip uninstall virtualenvwrapper.
I also entered the share directory to delete the virtualenvwrapper folder, but it does not appear. I'm pressing LS and the folder does not appear.
I am also trying "which virtualenvwrapper" or "which virtualenvwrapper_lazy.sh" but this simply returns the same folder as I am.
i just need help to remove that message of bash
Most likely, there is a reference (potentially with source or .) to virtualenvwrapper_lazy.sh in one of bash startup files. Look at the usual suspects: ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bash.rc, /etc/.bash_login
To help with debugging, consider getting by adding set -x to ~/.bashrc, or by running interactive session
bash -ix /dev/null
UPDATE, based on log:
Per https://superuser.com/questions/893448/bash-shell-error-no-such-file-or-directory/1049989
I just had the same problem on Linux Mint.
The following file was causing the issue:
/etc/bash_completion.d/virtualenvwrapper
I made a backup (just in case) and deleted it, and everything seems to
be working fine now.

ls,sudo commands not found (shell commands)

I tried to install laravel Framework in my mac OSX 10 .And I ended modifying my ~/.bash_profile to add the laravel command. laravel command seems to work normally .But another problem came out . ls ,sudo ...and other shell commands does not work .
-bash: ls: command not found
My bash.profile file contains the two links
export PATH="/Applications/MAMP/bin/php/php5.6/bin"
export PATH="$PATH:$HOME/.composer/vendor/bin"
check in ~/.bash_profile if this PATHs exist
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
your complete line should looks like this
export PATH=/Applications/MAMP/bin/php/php5.6/bin:$HOME/.composer/vendor/bin:/opt/local/bin:/opt/local/sbin:$PATH
reboot needed.
The binaries for the above mentioned utilities for debian distribution are usually in /bin or /usr/bin directory. Of course exporting path won't help if the binaries are not there.
There could be one simple approach to it -
Check for the location of binaries and then export the path in the bash_profile or .bashrc.
Run the bashrc script (. ~/.bashrc) following you may not require a reboot.

How to add something to bash path without messing up existing bash commands?

I'm doing some Android development and want to access the command line tools from anywhere.
There wasn't an existing .bash_profile file in my home directory so I created one and added the following line:
export PATH="/Users/Me/desktop/Android/Android SDK bundle/sdk/platform-tools"
I can now access the Android tools from terminal, however the ls command has stopped working, though cd still works. I get
-bash: ls: command not found
What should I do to get it to work again (and why has ls stopped working but cd still works?).
Try:
export PATH=$PATH:"/Users/Me/desktop/Android/Android SDK bundle/sdk/platform-tools"
It will append to the current PATH your sdk directory.
As for the later question, it stopped working because you overwritten your PATH variable, so bash can't find your binaries. However cdis a builtin command (http://linux.about.com/library/cmd/blcmdl1_builtin.htm) it doesn't need a path to be located and executed.

Add directory to system path in OS X Lion

I can't figure out how to add a directory to the system path. I found out that the command is something like this:
export PATH=$PATH:/my_path/to/my_dir
Example
I run the terminal in the path where my installation directory is located. In this case I'm talking about Play Framework. And I type:
export PATH=$PATH:/to/play20
It looks like nothing happens. In fact, when I type the command "play" (to execute the framework) I get:
-bash: play: command not found
Can someone please give me a decent step-by-step guide?
Execute the command “/to/play20/play help”. If this gives the expected output (help for the play command), then the executable is available, and the problem is in the shell path. If it does not give the expected output, then the executable is not working.
In the former case, ensure you are running the bash shell. (This is the default for recent versions of Mac OS X, but it may be changed for specific accounts.) To do this temporarily, execute the command “bash”. (When you want to exit the temporary shell, execute the command “exit”.) Then execute the export command again. (When the export command works, it changes the variable without displaying any output, so this is normal.) Check the spelling in the export command carefully.
In the latter case, execute “ls -ld /to/play20/play”. If you get a message that the file does not exist, then the executable is not installed correctly, and I cannot help you further. If the file is present, then it is not executable for some reason. This might be because you do not have permission to access it (especially permission to execute it, marked by “x” in certain places in the initial field of the ls output that may contain hyphens, “r”, “w”, and a few other letters) or that it is a symbolic link to a file that does not exist (indicated by an “l” in the first character of the ls output for the file). Lack of permission can be fixed by the chmod command, assuming you have appropriate permissions for changing permissions on the system. If the file is a symbolic link to another file, you may have a bad installation, or the target file may have permission issues (or be another symbolic link, and so on).

Resources