当方、flutterを用いてAndroidStudioでアプリ開発中。riverpodとfreezedを導入してビルドコマンドを打つも、エラーを吐かれる。
pubspec.yamlにもしっかり書いたし、pub getコマンドは成功したし、なんで・・・
C:\Users\ユーザー名\StudioProjects\アプリ名>flutter pub run build_runner build
Could not find package "build_runner". Did you forget to add a dependency?
pub finished with exit code 65
と思ったら、Terminalのディレクトリが間違っているだけでした。
ソースをGitHubで管理しており、今までとは違うディレクトリにクローンしたものを開いていたので、もとのディレクトリに対してコマンドを打っていただけだった。cdコマンドで新しいディレクトリを指定すればOKだった。
ちなみにドライブ間移動はcdではなくて「D:」と打ちます。(Dドライブに移動する場合)
D:\Documents\GitHub\アプリ名>flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 431ms
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 5.4s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 815ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 4.6s elapsed, 0/16 actions completed.
[INFO] Generating SDK summary completed, took 4.6s
[INFO] 5.8s elapsed, 16/18 actions completed.
[INFO] 6.8s elapsed, 16/18 actions completed.
[INFO] 13.1s elapsed, 16/18 actions completed.
[WARNING] freezed:freezed on lib/models/state_model.dart:
The class PostTrainingRecordPageCardState was declared as abstract, but it is not need anymore.
Read here: https://github.com/rrousselGit/freezed/tree/master/packages/freezed#the-abstract-keyword
[INFO] Running build completed, took 13.5s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 44ms
[INFO] Succeeded after 13.6s with 1 outputs (18 actions)
通った。
こういう初歩的な間違いに詰まっていたあたり、まだまだだなと実感・・
コメント