👻

【Flutter】突然 flutter clean / build でエラーが出るようになったときの対処法

に公開

発生したエラー

FlutterでWindows/MacOSアプリを開発しています。
ある日突然、fvm flutter cleanで以下のエラーが発生するようになりました:

fvm flutter clean
----------
Flutter failed to delete a directory at "build".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

buildも試行してみると、こちらもエラーに:

fvm flutter build macos --release
----------
Compilation failed. Unable to write to path: MainMenu.nib
You don’t have permission to save the file…

両者のエラー内容から、buildフォルダ内のファイルが書き込み不可状態になっているようです。
おそらく途中でビルドに失敗したか何かで、中途半端な状態でファイルが残っていたり壊れているのだと思われます。

対処法

buildフォルダを削除して再度clean/buildを実行すると、無事に成功しました。

【宣伝】Light Notes

Windows向けにメモ帳アプリをMicrosoftストアで公開しています。
✅メモを無制限に作成
✅色分けして整理
✅自分の好きな場所にバックアップ

少しでもご興味がありましたら、ぜひお試しください!
https://apps.microsoft.com/detail/9p757ldfn9x3?hl=ja-JP&gl=JP

Discussion