Flutter development-environment variable failure problem of MAC terminal configuration

Practical problem: After the mac has configured the environment variables, the synchronization detection is successful, and everything is normal when viewing the version. After restarting the terminal or vscode, the compiled code appears bin/sh: dart: command not found.
The cause of the problem: zsh is installed on the mac, and zsh loads the ~/.zshrc file, but does not load the ~/.bash_profile file.
Solution:
1. Terminal cd to the ~/.zshrc file location (the file path is generally /Users/username/.zshrc), execute the command: open -e .zshrc 2. Add
source ~/.bash_profile in the last line
*Note that vscode needs to be restarted

Guess you like

Origin blog.csdn.net/qq_25218777/article/details/109316683