開発環境
PC:macOS Monterey
エディター:Visual Studio Code
内容
Flutterのバージョン管理にfvmを使用していたが、fvm flutterコマンドが実行できなくなった。
エラー内容
・
・
・
Downloading _fe_analyzer_shared 29.0.0...
Reinstalled 1061 packages.
Reactivating devtools 2.7.0...
Precompiling executables...
Precompiled devtools:devtools.
Installed executable devtools.
Reactivating fvm 2.2.3...
Precompiling executables...
Failed to precompile fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Failed to reactivate fvm 2.2.3: Failed to precompile fvm:main:
Error: Couldn't resolve the package 'fvm' in 'package:fvm/src/runner.dart'.
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:3:8: Error: Not found: 'package:fvm/src/runner.dart'
import 'package:fvm/src/runner.dart';
^
.pub-cache/hosted/pub.dartlang.org/fvm-2.2.3/bin/main.dart:6:14: Error: Method not found: 'FvmCommandRunner'.
exit(await FvmCommandRunner().run(args));
^^^^^^^^^^^^^^^^
Binstubs exist for non-activated packages:
From fvm: fvm
Reactivated 1 package.
Failed to reactivate 1 package:
- fvm
pub finished with exit code 69
このエラー発生後、fvmコマンドが使用できなくなった。
fvmコマンドを実行すると、下記のようなエラーが発生する。
zsh: command not found: fvm
原因
下記コマンドを実行したこと。
flutter pub cache repair
解決策
pub global activate fvm
もう一度上記コマンドを実行するか、homebrew経由でfvmをインストールする。
参考
関連記事