如何解决“ Flutter build_runner FileException errorno = 3”错误?

时间:2020-06-29 17:54:54

标签: windows flutter build-runner

能帮我解决与build_runner相关的问题吗? 在运行命令“ flutter packages pub run build_runner watch --delete-conflicting-outputs”时,出现FileException errorno = 3错误。

我怀疑这是Windows问题。因为错误消息中生成的路径是小写('c:\ users \ xxxx \ git-dev \ flutter \ xxx \ xxxx \ xxxx *'),而实际路径是(C:\ Users \ xxxx \ git -dev \ Flutter \ xxx \ xxxx \ xxxx *')具有一些大写字符。

[INFO] Generating build script...
[INFO] Generating build script completed, took 414ms

[INFO] Setting up file watchers...
[INFO] Setting up file watchers completed, took 11ms

[INFO] Waiting for all file watchers to be ready...

[SEVERE] Error from directory watcher for package:xxxxxx
If you see this consistently then it is recommended that you enable the polling file watcher with --use-polling-watcher.

You have hit a bug in build_runner

Please file an issue with reproduction steps at https://github.com/dart-enter code herelang/build/issues
     
FileSystemException: Directory listing failed, path =
'c:\users\xxxx\git-dev\flutter\xxx\xxxx\xxxx*' (OS Error: The system
cannot find the path specified., errno = 3)


Flutter doctor -v output is following:
[√] Flutter (Channel beta, 1.19.0-4.2.pre, on Microsoft Windows [Version 10.0.18363.900], locale en-IN)
• Flutter version 1.19.0-4.2.pre at C:\Users\xxxxxx\flutter
• Framework revision 9b9b543d92 (6 days ago), 2020-06-22 12:19:28 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)

根据错误消息的建议,我使用了“ flutter pub run build_runner watch --use-polling-watcher”命令。但是,我开始遇到另一种错误。

AssetNotFoundException: xxxx_xxxxx|.packages
package:build_runner_core/src/asset/file_based.dart 134:18 _fileForOrThrow.
dart:async _completeOnAsyncReturn
package:pool/pool.dart Pool.withResource
package:build_runner_core/src/asset/file_based.dart 133:26 _fileForOrThrow
package:build_runner_core/src/asset/file_based.dart 33:48 FileBasedAssetReader.readAsBytes
package:build_runner/src/generate/watch_impl.dart 326:52 WatchImpl._run.
package:build_runner/src/generate/watch_impl.dart WatchImpl._run.
package:build_runner/src/generate/watch_impl.dart 355:6 WatchImpl._run
package:build_runner/src/generate/watch_impl.dart 196:20 new WatchImpl
package:build_runner/src/generate/watch_impl.dart 127:5 _runWatch
package:build_runner/src/generate/watch_impl.dart 85:15 watch
dart:async _completeOnAsyncReturn
package:build_runner_core/src/generate/options.dart BuildOptions.create
dart:async _completeOnAsyncReturn
package:build_runner_core/src/package_graph/target_graph.dart TargetGraph.forPackageGraph
dart:async _completeOnAsyncReturn
package:build_runner_core/src/package_graph/target_graph.dart _packageBuildConfig
dart:async _completeOnAsyncReturn
package:build_config/src/build_config.dart BuildConfig.fromBuildConfigDir

1 个答案:

答案 0 :(得分:0)

我弄清楚了问题及其解决方法。

由于我在flutter应用程序中使用了“ moor”软件包,因此请按照其页面(https://moor.simonbinder.eu/docs/using-sql/sql_ide/)上的说明进行设置。

一旦我在VSCode json设置中添加了以下行:

“ dart.additionalAnalyzerFileExtensions”:[“系泊”]

“ flutter包pub run build_runner watch --delete-conflicting-outputs”命令停止工作。

在删除VSCode json设置后,我能够再次运行build_runner命令。