pod install 报错

最近在做flutter项目,执行flutter run 的时候,会在iOS项目中执行pod install 这个命令,但是在执行过程中会报一些错误此文记录一下。

1、我这个是ruby环境问题,按照GitHub上操作没有解决,1、https://github.com/CocoaPods/CocoaPods/issues/7697

;2、https://github.com/CocoaPods/CocoaPods/issues/6992
;3、https://github.com/CocoaPods/CocoaPods/issues/8003

目前我已经解决了,我是Mac电脑,系统自带ruby环境,但是我又安装了jruby ,可能是jruby 配置的有问题,我把jruby 删了,又重新升级了一下ruby,重新安装了cocoapods,就可以了。在网上找了同样的一个错误,在此记录一下,错误提示如下文:
Report
What did you do?
pod install
What did you expect to happen?
Install all pod dependencies correctly.

What happened instead?
Stack

CocoaPods : 1.5.3
Ruby : jruby 9.2.0.0 (2.5.0) 2018-11-01 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [darwin-x86_64]
RubyGems : 2.7.7
Host : Mac OS X 10.14 (18A391)
Xcode : 10.1 (10B61)
Git : git version 2.17.2 (Apple Git-113)
Ruby lib dir : /Users/hexu/.rvm/rubies/jruby-9.2.0.0/lib
Repositories :
Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.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'

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Error

NameError - uninitialized constant Nanaimo::Reader::StringScanner
Did you mean?  Nanaimo::Reader::StringScanner
               StringScanner
org/jruby/RubyModule.java:3526:in `const_missing'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/nanaimo-0.2.6/lib/nanaimo/reader.rb:97:in `initialize'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/xcodeproj-1.7.0/lib/xcodeproj/plist.rb:27:in `read_from_path'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/xcodeproj-1.7.0/lib/xcodeproj/project.rb:206:in `initialize_from_file'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/xcodeproj-1.7.0/lib/xcodeproj/project.rb:108:in `open'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:918:in `block in inspect_targets_to_integrate'
org/jruby/RubyHash.java:1396:in `each'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:917:in `block in inspect_targets_to_integrate'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:912:in `inspect_targets_to_integrate'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/analyzer.rb:78:in `analyze'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:243:in `analyze'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:153:in `resolve_dependencies'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:116:in `install!'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/gems/cocoapods-1.5.3/bin/pod:55:in `<main>'
org/jruby/RubyKernel.java:994:in `load'
/usr/local/bin/pod:1:in `<eval>'
org/jruby/RubyKernel.java:1037:in `eval'
/Users/hexu/.rvm/gems/jruby-9.2.0.0/bin/jruby_executable_hooks:24:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=uninitialized+constant+Nanaimo%3A%3AReader%3A%3AStringScanner%0ADid+you+mean%3F++Nanaimo%3A%3AReader%3A%3AStringScanner%0A+++++++++++++++StringScanner&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

  • pod init error: NameError

2、在添加新的第三方依赖后,重新运行项目,报错:

Analyzing dependencies
[!] CDN: trunk Repo update failed - 13 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/f/f/3/WechatOpenSDK/1.7.7/WechatOpenSDK.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/f/f/3/WechatOpenSDK/1.7.8/WechatOpenSDK.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/f/f/3/WechatOpenSDK/1.7.9/WechatOpenSDK.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/f/f/3/WechatOpenSDK/1.8.0/WechatOpenSDK.podspec.json Response: Couldn't connect to server
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/f/f/3/WechatOpenSDK/1.8.1/WechatOpenSDK.podspec.json Response: Couldn't connect to server。。。。。。

解决方法:在Podfile 添加source,然后执行 pod repo remove trunk,然后pod install,就可以了

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,254评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,875评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,682评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,896评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,015评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,152评论 1 291
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,208评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,962评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,388评论 1 304
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,700评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,867评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,551评论 4 335
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,186评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,901评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,142评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,689评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,757评论 2 351