Flutter pod 安装问题 - #<Dir:0x00007fa6f7e2ec80> 的未定义方法 `each_child' [英] Flutter pod install problem - undefined method `each_child' for #<Dir:0x00007fa6f7e2ec80>

查看:43
本文介绍了Flutter pod 安装问题 - #<Dir:0x00007fa6f7e2ec80> 的未定义方法 `each_child'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Flutter 应用程序,但在运行 pod install 时突然出现以下错误.我需要提一下,我搜索了很多并尝试了太多方法,但不幸的是没有人有确切的 undefined method 'each_child' 错误.正如人们所说,我还删除了 Podfile.lock 和 Pod 文件夹,并且没有再次生成:(

I was working on a Flutter app and suddenly got the following error when I run pod install. I need to mention that I searched a lot and tried too many ways but unfortunately nobody had the exact undefined method 'each_child' error. I also delete the Podfile.lock and Pod folder as people said and didn't generate again :(

错误:

[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `each_child' for #<Dir:0x00007f82a354e4f8>

/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:50:in `block in flutter_additional_ios_build_settings'
/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:47:in `each'
/Users/vahidnaghash/Developer/flutter/packages/flutter_tools/bin/podhelper.rb:47:in `flutter_additional_ios_build_settings'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:39:in `block (3 levels) in from_ruby'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:38:in `each'
/Users/vahidnaghash/AndroidStudioProjects/careberry_flutter/careberry/ios/Podfile:38:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:897:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:885:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:884:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:329:in `block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:328:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:307:in `create_and_save_projects'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:178:in `integrate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:166:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

颤动医生:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.25.0-5.0.pre.92, on Mac OS X 10.14.6 18G103 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.1)
[✓] VS Code (version 1.49.1)
[✓] Connected device (2 available)

• No issues found!

Pods 已安装:(运行 gem list --local | grep cocoapods)

cocoapods (1.10.0)
cocoapods-core (1.10.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.4.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-trunk (1.5.0)
cocoapods-try (1.2.0)

Podfile:

# Uncomment this line to define a global platform for your project
 platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

推荐答案

我通过在终端中运行 flutter channel stable 将 flutter channel 从 master 更改为 stable .我猜主频道有问题!

I changed the flutter channel from master to stable by running flutter channel stable in terminal. I guess there is a bug on master channel!

这篇关于Flutter pod 安装问题 - #&lt;Dir:0x00007fa6f7e2ec80&gt; 的未定义方法 `each_child'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆