Flutter Pod 安装失败 - '无效的 `Podfile` 文件没有将 nil 隐式转换为字符串

Posted

技术标签:

【中文标题】Flutter Pod 安装失败 - \'无效的 `Podfile` 文件没有将 nil 隐式转换为字符串【英文标题】:Flutter Pod install failed - 'Invalid `Podfile` file no implicit conversion of nil into StringFlutter Pod 安装失败 - '无效的 `Podfile` 文件没有将 nil 隐式转换为字符串 【发布时间】:2021-02-11 04:18:16 【问题描述】:

我克隆了可穿戴项目 https://github.com/sbis04/flutter_os_wear

正在运行 pod 安装... CocoaPods 的输出: ↳

[!] Invalid `Podfile` file: no implicit conversion of nil into String.

 #  from /Volumes/Storage/Bottle/Wearables/flutter_os_wear/ios/Podfile:57
 #  -------------------------------------------
 #      unless File.exist?(copied_framework_path)
 >        FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
 #      end
 #  -------------------------------------------

/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:301:in `rescue in block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:295:in `block in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:50:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:293:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:293:in `from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.3/lib/cocoapods-core/podfile.rb:259:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/config.rb:200:in `podfile'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:150:in `verify_podfile_exists!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:46:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

CocoaPods 的错误输出: ↳ 忽略 ffi-1.12.2,因为它的扩展没有构建。试试: gem pristine ffi --version 1.12.2

【问题讨论】:

【参考方案1】:

尝试取消注释 $PROJECT/ios/Podfile 中的这一行 platform :ios, '8.0' 并将其设置为更高版本(如 9.0)。

【讨论】:

已经9了,我已经更新到10.0了,但是错误依旧 创建新项目并将这个克隆的 repo 迁移到其中并尝试运行它我认为它应该可以工作 嗯好的,我会试试的 @AmarMaharjan 你解决了吗。因为我有同样的问题 @NaderKhaled 试试我的答案,因为它也对我有用

以上是关于Flutter Pod 安装失败 - '无效的 `Podfile` 文件没有将 nil 隐式转换为字符串的主要内容,如果未能解决你的问题,请参考以下文章

运行 pod install 时 Flutter iOS 构建失败

Firebase 安装

pod 安装时出现 Flutter 错误:CocoaPods 找不到 pod“Firebase/CoreOnly”的兼容版本

Flutter 调试:警告:未安装 CocoaPods。跳过 pod 安装

Mac OS Flutter 构建 appbundle 失败:密钥库格式无效

不知道在哪里添加pod文件flutter ios安装