经过多次的 Flutter 版本升级,以前的老项目脚本在执行 flutter pub get 相关的命令时候报错如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
$ /bin/bash /home/xxxx/xxx/build_runner.sh Resolving dependencies in `/home/xxxx/xxxx`... Downloading packages... Got dependencies in `/home/xxxx/xxx`. Building package executable... (3.1s) Built custom_lint:custom_lint. Analyzing... 0.0s No issues found! Building package executable... (3.3s) Built build_runner:build_runner. [INFO] Generating build script completed, took 297ms [INFO] Precompiling build script......Could not find a command named "/data/Android/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot". Usage: dart <command|dart-file> [arguments] Global options: -v, --verbose Show additional command output. --version Print the Dart SDK version. --enable-analytics Enable analytics. --disable-analytics Disable analytics. --suppress-analytics Disallow analytics for this `dart *` run without changing the analytics configuration. -h, --help Print this usage information. Available commands: analyze Analyze Dart code in a directory. compile Compile Dart to various formats. create Create a new Dart project. devtools Open DevTools (optionally connecting to an existing application). doc Generate API documentation for Dart projects. fix Apply automated fixes to Dart source code. format Idiomatically format Dart source code. info Show diagnostic information about the installed tooling. pub Work with packages. run Run a Dart program. test Run tests for a project. Run "dart help <command>" for more information about a command. |
解决方法为删除项目下的所有 pubspec.lock 文件即可。