after source ~/.zshrc, zsh terminal does not work - terminal

I try to set up react native android development environment
vim ~/.zshrc
paste ANDROID_SDK_ROOT environment variable
source ~/.zshrc
However, the following error occurred
/Users/username/.zshrc:source:26: no such file or directory: /Users/username/.zshrc#
/Users/username/.zshrc:source:26: no such file or directory: /Users/username/.zshrc#
/Users/username/.zshrc:source:26: no such file or directory: /Users/username/.zshrc#
/Users/username/.zshrc:source:51: too many open files: /Users/username/.zshrc
/Users/username/.zshrc:source:75: too many open files: /Users/username/.oh-my-zsh/oh-my-zsh.sh
/Users/username/.zshrc:source:108: too many open files: /Users/username/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
/Users/username/.zshrc:source:109: too many open files: /Users/username/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
/opt/homebrew/Library/Homebrew/prefix.sh: line 40: echo: write error: Bad file descriptor
/Users/username/.zshrc:source:112: no such file or directory: /nvm.sh
/Users/username/.oh-my-zsh/oh-my-zsh.sh:source:61: too many open files: /Users/username/.oh-my-zsh/tools/check_for_upgrade.sh
/Users/username/.oh-my-zsh/oh-my-zsh.sh:source:122: too many open files: /Users/username/.oh-my-zsh/lib/compfix.zsh
compinit:503: cannot duplicate fd 0: too many open files
/Users/username/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh:31: write error: bad file descriptor
[256] done bindkey "$3"
And then zsh terminal does not work even node -v
It terminated immediately in the vscode
How can I solve this problem?

I'm going to assume you're using Oh My Zsh given that this was tagged with oh-my-zsh. As the creator of Oh My Zsh, I would encourage you to not append your Android SDK environment variable to ~/.zshrc but consider enabling the dotenv plugin that comes packaged with Oh My Zsh.
then you can define your ANDROID_SDK_ROOT in the parent directory of your project

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

Warning on git bash start "bash: C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh: No such file or directory"

Whenever I open git bash I get the following warning:
bash: C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh: No such file or directory
The problem is that I uninstalled Anaconda, because I installed independent python, which resulted in giving that error.
How to remove this Warning.
Check the content of ~/.bashrc (which was mentioned here)
Maybe that (or ~/.profile, mentioned here) includes a command for that old uni uninstalled program.
Remove those lines, and try to open again a git bash session.
To remove that warning, simply erase the file path string in the .bashrc file using nano command. Here's how:
Steps to remove that warning:
Open Git Bash and check .bashrc location by typing ~/.bashrc into git bash.
Navigate to folder where .bashrc file is located.
Type nano .bashrc
Erase the string that says C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh
Press ctrl+O to save .bashrc file and then ctrl+X to exit.
When you reopen git bash nothing should appear because .bashrc doesn't have that path in it anymore. Also, if conda commands were working before it will still continue to work after erasing this.

bash-compl and bash-completion: no such file or directory

Whenever I open a terminal, the following errors pop out instantly:
bash: /usr/share/bash-compl: No such file or directory
bash: etion/bash_completion: No such file or directory
Also, when I try to compile my ~/.bashrc I get the same errors.
What should I do?
P.S. (I'm using Ubuntu 16.04 LTS)
There was a newline in ~/.bashrc which caused the breaks in those lines. Removing it fixed the issue.
Following steps worked for me:
Go to /etc/skel and do ls -a.
Locate .bashrc.
Copy that or open it with any editor and copy it to the home .bashrc file.

/Users/DylanRichards/.profile:source:2: no such file or directory: QSTK/local.sh

I'm going to open this up again. I installed this thing called QSTK for some financial calculations. Now every time I open my terminal, I get this error:
/Users/DylanRichards/.profile:source:2: no such file or directory: QSTK/local.sh
Because of this error, I am unable to run programs in Sublime Text as well.
How the heck do I get rid of this?
Latest
After trying KEYSER's suggestion, here are the contents of the .profile file:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
source QSTK/local.sh
PATH=$PATH:/Applications/Darwine/Wine.bundle/Contents/bin/
QSTK seems to have injected some line into your profile file, which is loaded by the terminal at startup. That line is trying to run a script which doesn't exist.
To get rid of the error remove line 2 in .profile (and possibly surrounding, related, lines).
It's a hidden file, so you can e.g. open it from a terminal. for example:
open -a "/Applications/Sublime Text.app/" ~/.profile
if that's the name of your sublime app (tab to autocomplete)
How do I find and edit ~/.profile?
In Terminal:
$ cd ~
$ touch .profile
$ open -e .profile
This will open the .profile file in TextEdit for your editing enjoyment.
Once you have completed your editing, save the file in TextEdit and then, in Terminal:
$ source .profile
This should avoid the need for a system restart but always a good idea to do a restart anyway when playing with fundamentals like .____ files.

Bash Issue When Terminal Opens

Whenever I open Terminal I get the following messages:
bash: /etc/profile.d/sm.sh: No such file or directory
bash: /etc/profile.d/rvm.sh: No such file or directory
These don't seem to impact anything but are incredibly annoying.
The entry will be in one of the dot files which are run when you open a new terminal or login.
In your home directory you will find the entry in one of
.profile
.bashrc
.bash_profile
If it's not in there it could be in the system wide start file /etc/profile.

Resources