简体   繁体   中英

flutter doctor 'zsh: command not found'

I have installed flutter and set up the path with the zsh file for Catalina version of mac however when I run flutter doctor or flutter precache, I receive zsh : command not found: flutter. NOTE: I managed to get through these steps previously and set up android studio however I had issues when I tried to connect the simulator for Xcode and now I have had to start again.

UPDATE: When running 'flutter' or 'flutter doctor', I receive this error: Error when reading '../../../../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No such file or directory and it says that pub upgrade failed after 10 tries. How would I solve this?

When I run ls -a in the home directory, I see that there's a .bash_profile, a .zshrc file and a .zprofile (which I created previously) in there. Is this related to the problem?

This looks like you don't have flutter on your PATH in ZSH.

Open your .zshrc file in your terminal with

nano .zshrc

You should see the following at the top of the file

# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH

Add on the second line the path to the bin directory of your flutter SDK location, like mine:

export PATH=$HOME/bin:/usr/local/bin:$PATH:/Users/joaosoares/Projects/flutter/bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM