flutter错误无效的`Podfile`文件:没有将nil隐式转换为String。我搜索了讨论,但我似乎无法解决问题
这是我收到的错误。我尝试了 flutter clean 并更改了一些行的语法,但我是 dart 和 flutter 的新手,所以我不太确定。我也重新安装了可可豆荚和红宝石,但我收到了同样的错误。我还确保将 ruby 更新到最新版本。
[!] Invalid `Podfile` file: no implicit conversion of nil into String.
# from /Users/(name)/Downloads/Projects/doctor_consultation_app/ios/Podfile:57
# -------------------------------------------
# unless File.exist?(copied_framework_path)
> FileUtils.cp(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
# end
# -------------------------------------------
[!] Invalid `Podfile` file: no implicit conversion of nil into String.
# from /Users/(name)/Downloads/Projects/doctor_consultation_app/ios/Podfile:57
# -------------------------------------------
# unless File.exist?(copied_framework_path)
> FileUtils.cp(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
# end
# -------------------------------------------
这是我的 pod 文件。
回答
当我将 flutter sdk 更新到新的 flutter 2.0 时出现此错误,但我的项目是使用旧版本的 flutter sdk (1.22) 创建的。
通过固定它删除了Podfile与Podfile.lockIOS文件夹中,然后运行:
flutter run
或者
flutter build ios
这样flutter就会为flutter 2.0生成新的Podfile
回答
当我更新我的 mac --> BigSur 并使用 Ruby 时,我遇到了同样的问题。
我通过rm -rf ios和解决它flutter create .
然后在新的 ios 中修复一些文件更改
- Don't use this on your existing app, This deleted my iOS folder and flutter create command will create a new project. Thankfully I use git and could reset to my commit.
THE END
二维码