2

I try to set up react native android development environment

  1. vim ~/.zshrc
  2. paste ANDROID_SDK_ROOT environment variable
  3. 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?

nuru
  • 21
  • 3
  • I'm assuming your platform is Apple Silicon. Your ~/.zshrc is problematic and needs to be fixed. You can open a new shell using `/bin/zsh -f` to ignore ~/.zshrc, and inspect your ~/.zshrc in that environment. (In Terminal.app, uncheck "login" shell, and input this specific path instead) I also find that you put `#` too close to your command. Since `#` can appear in a file name, you need to put space(s) before it to start a comment. With limited information, that's all that I can think of. It would be useful if you could paste related commands around line 26. – Simon Smith Jul 05 '22 at 05:43
  • 2
    _How can I solve this problem?_ ... As always, with debugging: Put a `set -x` as first statement of your .zshrc, and open a new terminal tab. Observe the debugging output: It will show you all statements which get executed. From this, you will see which command causes the error and then you fix it. – user1934428 Jul 05 '22 at 05:55

1 Answers1

2

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