如何解决pubspec.lock 文件自 .dart_tool/package_config.json 文件生成后已更改,请再次运行“pub get”
我尝试使用自定义预测试脚本在 codemagic 上运行测试。这是我的预测试脚本:
#!/bin/sh
cd libraries
cd dependencies
Flutter pub get
cd ..
cd core
Flutter pub get
Flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
Flutter pub get
Flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
Flutter pub get
Flutter pub run build_runner build --delete-conflicting-outputs
但是当 pre-test
运行时,我收到此错误:
Running "Flutter pub get" in dependencies... 2.5s
Running "Flutter pub get" in core... 4.9s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated,please run "pub get" again.
pub finished with exit code 65
Running "Flutter pub get" in splash... 3.0s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated,please run "pub get" again.
pub finished with exit code 65
Running "Flutter pub get" in proposal... 3.2s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated,please run "pub get" again.
pub finished with exit code 65
Build Failed :|
Step 4 script `Pre-test script` exited with status code 65
我认为这个错误是因为 Flutter pub run build_runner build --delete-conflicting-outputs
当我想通过 codemagic 生成 .g.dart
文件时。
我尝试谷歌但仍然没有找到解决方案,有人可以帮助我如何解决 codemagic 上的这个错误吗?
解决方法
我修复了两次添加 flutter pub run
。
#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。