Flutter command not found

前端 未结 30 1334
独厮守ぢ
独厮守ぢ 2020-11-29 16:54
bash: flutter: command not found

Apparently, none of the flutter commands are working on the terminal of an android studio which I believe I am tryi

30条回答
  •  攒了一身酷
    2020-11-29 17:16

    You need to correctly set up your flutter path.

    from here https://flutter.dev/docs/get-started/install/macos#update-your-path

    1. Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
    2. Open (or create) $HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile

    macOS Catalina uses the Z shell by default, so edit $HOME/.zshrc.

    If you are using a different shell, the file path and filename will be different on your machine.

    1. Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s git repo:

    export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH

    for example:

    export PATH=~/Documents/flutter/bin:$PATH

    1. press CTRL X and when it asked you to save the file, choose yes

    2. Run source $HOME/.bash_profile to refresh the current window or restart the terminal

    3. Verify that the flutter/bin directory is now in your PATH by running: echo $PATH

    Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed flutter SDK, not the location of your app

    Instead of nano, you can use any text editor to edit ~/.bash_profile

提交回复
热议问题