MENU

MENU

カテゴリー

\気になるカテゴリーをクリック!/

やきいも
文系SE
【プロフ】
 ▶ 30代半ば
 ▶ ITエンジニア13年目 | 業務システム
 ▶ 妻と息子の3人で田舎の暮らし

【サイト運営】
このブログは私の体験をもとに以下に関する情報をお届けしています。
 ▶ AI
 ▶ Java
 ▶ Flutterなど
Udemyセール!最大95%オフ!1,200円~4月の最新セール情報をみる

【Flutterエラー対応】zsh: command not found: flutter

この記事には広告を含む場合があります。

Flutterでスマホアプリ開発をしたい!
Flutter の公式サイトからSDKをインストールして、パスの設定をしてパスが通っているか確認ができない。

zsh: command not found: flutter
と表示されて、どう対応したら良いのか分からない。

やきいも

この記事はこんな人におすすめです!
flutterの開発環境の構築で順調に進んでない方

この記事で分かること!
  • zsh: command not found: flutter が表示されたときの対処法

フリーランスのFlutterエンジニアとして働きたい方にオススメのエージェントはこちらで詳しく解説しています。

目次

事象(zsh: command not found: flutter)

開発環境

モデルMacBook Air 2020
CPU・GPUM1(GPU8コア GPU8コア)
メモリ16GB
SSD512GB

FlutterのSDKをインストールして、pathを設定後に、flutterとコマンドを打ってみたがzsh:command not found : flutterと表示され確認ができない。

Last login: Tue Aug  9 21:35:40 on console
XXX@tinoMacBook-Air ~ % flutter
zsh: command not found: flutter

   

原因:設定したpathが間違っていた

設定したpathが正しいか次の方法で確認しましょう

Finderからホームで、隠しファイルを表示させます。

隠しファイルの表示方法は、「Shift + command + .」です。

.zshrc ファイルを右クリックしてテキストエディトを選択して、ファイルを開きます。

ファイルを開くと、設定したpathが書かれてます。

正しいか確認しましょう。

export PATH=PATH:/Users/yakiimo/development/flutter/bin
export PATH=/Users/yakiimo/development/flutter/bin
export PATH="$PATH:/Users/yakiimo/development/flutter/bin"
やきいも

私は上記のようにpathで複数設定されてて、うまく動作できなかったです。

ターミナルから、echo $PATH でも確認はできます。

echo $PATH で確認

Last login: Tue Aug  9 21:35:40 on console
XXX@tinoMacBook-Air ~ % echo $PATH
PATH=PATH:/Users/yakiimo/development/flutter/bin:
PATH=/Users/yakiimo/development/flutter/bin:
PATH="$PATH:/Users/yakiimo/development/flutter/bin"

対処方法(正しいpathを設定する)

正しいpathのみ残して、間違ったpathは削除してファイルを保存します。

export PATH="$PATH:/Users/yakiimo/development/flutter/bin"

再度、ターミナルで flutterと打ってみましょう!

Last login: Tue Aug  9 21:35:40 on console
XXX@tinoMacBook-Air ~ % flutter
Manage your Flutter app development.

Common commands:

  flutter create <output directory>
    Create a new Flutter project in the specified directory.

  flutter run [options]
    Run your Flutter application on an attached device or in an emulator.

Usage: flutter <command> [arguments]

Global options:
-h, --help                  Print this usage information.
-v, --verbose               Noisy logging, including all shell commands
                            executed.
                            If used with "--help", shows hidden options. If used
                            with "flutter doctor", shows additional diagnostic
                            information. (Use "-vv" to force verbose logging in
                            those cases.)
-d, --device-id             Target device id or name (prefixes allowed).
    --version               Reports the version of this tool.
    --suppress-analytics    Suppress analytics reporting when this command runs.

Available commands:

Flutter SDK
  bash-completion   Output command line shell completion setup scripts.
  channel           List or switch Flutter channels.
  config            Configure Flutter settings.
  doctor            Show information about the installed tooling.
  downgrade         Downgrade Flutter to the last active version for the current
                    channel.
  precache          Populate the Flutter tool's cache of binary artifacts.
  upgrade           Upgrade your copy of Flutter.

Project
  analyze           Analyze the project's Dart code.
  assemble          Assemble and build Flutter resources.
  build             Build an executable app or install bundle.
  clean             Delete the build/ and .dart_tool/ directories.
  create            Create a new Flutter project.
  drive             Run integration tests for the project on an attached device
                    or emulator.
  format            Format one or more Dart files.
  gen-l10n          Generate localizations for the current project.
  pub               Commands for managing Flutter packages.
  run               Run your Flutter app on an attached device.
  test              Run Flutter unit tests for the current project.

Tools & Devices
  attach            Attach to a running app.
  custom-devices    List, reset, add and delete custom devices.
  devices           List all connected devices.
  emulators         List, launch and create emulators.
  install           Install a Flutter app on an attached device.
  logs              Show log output for running Flutter apps.
  screenshot        Take a screenshot from a connected device.
  symbolize         Symbolize a stack trace from an AOT-compiled Flutter app.

Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used
options.

   

まとめ:pathが設定されているファイルを確認

今回の記事では、flutterの開発環境の構築時にpathを設定する際に

zsh: command not found: flutterが表示されたときの対処法について解説しました。

ポイント!
  • pathが設定されているファイルを確認しましょう!
やきいも

Flutter公式ページでSDKのインストールからPATHの設定まで書かれています。ご参考にどうぞ。英語ですが、何となくわかりますよ!

Flutterエンジニアになるには?

初心者が中級者レベルのFlutterエンジニアなるまでの進め方をまとめました。

Flutterの学習方法を知る

Flutter をスクールで学ぶ

Flutterの副業を探す

おまけFlutter入門の完全ガイド

Flutter/Dartの基礎一覧

Flutter/Dartの入門知識として押さえておきたい内容をまとめました。学習のご参考にどうぞ。

Widget(ウィジェット) 一覧

Dart 基本文法

ライブラリ 使い方

コメント

コメントする

CAPTCHA


目次