Windows 10上のFlutter doctorでVisual Studioの未インストールエラーが出る問題の解決策

この記事は公開から2年以上経過しています。

Linux環境では問題なく動作していたFlutter(3.0.2)をWindows 10デスクトップ開発で試そうとしたところ、Flutterの環境構築でエラーが発生していきなりハマってしまったので、解決策についての備忘録。

Flutter側のソースを静的に見ても特に問題なさそうだったのですが、まさかアッチが原因だったとは…。
この週末に色々と実験しておきたかったのですが、時間を浪費してしまいました…。


問題

Windows 10でflutter doctorコマンドを実行すると「Visual Studio」と「C++によるデスクトップ開発」ワークロードが正しくインストールされているにも関わらず

[X] Visual Studio – develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components

のようなVisual Studioが見つからないエラーが発生してしまう。


原因

vswhere.exeの文字コード絡みの不具合の模様。


対応

%ProgramFiles(x86)%\Microsoft Visual Studio\Installerにあるvswhere.exeを、
GitHubの最新のvswhere.exeに差し替える。


参考ウェブサイトなど

  • StackOverflow
    Flutter doctor is not detecting visual studio

  • GitHub
    [windows] Exception: Bad UTF-8 encoding when running flutter doctor or building/running for Windows #102451

以上です。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする