In react Native, after we use brew to install NVM, and after the project is created, the next time you use Xcode7 to open the project, you find that the run failed. The reason is that NVM is not available for the following reasons:
Cause: Make sure to set it up in your bash or zsh profile after the brew is installed, otherwise when you restart the terminal, you will notice that node, NPM environment variables are invalidated.
1. Open Terminal (terminal)
2, cd ~ (enter the current user's home directory)
3. Open. Bash_profile (Opens the. bash_profile file, creates the file if the file does not exist: Touch. Bash_profile Edit file: open-e. bash_profile)
4. Directly change the contents of the. bash_profile file that pops up, and paste the following in:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
5. Command + S Save file, then close.
6. In terminal (terminal), enter source. bash_profile (using the content you just updated).
React Native (MAC) terminal modified ~/.BASHRC, ~/.profile, ~/.ZSHRC