Flutter报错:Warning: CocoaPods is installed but broken

最近在做Flutter开发,在跑iOS的时候报错:

结论:CocoaPods安装有问题

解决办法:

先卸载本地CocoaPods,然后重新安装

查看当前版本

复制代码
gem list | grep cocoapods

执行卸载

复制代码
sudo gem uninstall cocoapods

直到

复制代码
which -a pod

为空

然后重新安装

复制代码
sudo gem install -n /usr/local/bin cocoapods

这里会卡住等待,安装完成以后

复制代码
pod setup

如果报错:

ruby 复制代码
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:16:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError)
	from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:9:in `<module:ActiveSupport>'
	from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:8:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_silence.rb:5:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger.rb:3:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.10/lib/active_support.rb:29:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.16.2/lib/cocoapods.rb:7:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.16.2/bin/pod:36:in `<top (required)>'
	from /usr/local/bin/pod:23:in `load'
	from /usr/local/bin/pod:23:in `<main>'

就执行:

复制代码
sudo gem uninstall concurrent-ruby
sudo gem install concurrent-ruby -v 1.3.4

然后执行

复制代码
pod setup

最后执行

复制代码
pod --version

查看当前安装版本

相关推荐
星秋Eliot1 天前
Flutter多线程
flutter·async/await·isolate·flutter 多线程
农夫三拳_有点甜1 天前
Flutter Assets & Media
flutter
林间风雨2 天前
flutter项目 -- 换logo、名称 、签名、打包
flutter
SoaringHeart2 天前
Flutter组件封装:页面点击事件拦截
前端·flutter
tangweiguo030519872 天前
Flutter与原生混合开发:实现完美的暗夜模式同步方案
android·flutter
程序员老刘2 天前
CTO紧急叫停AI编程!不是技术倒退,而是...
flutter·ai编程
leazer2 天前
Flutter TabBar 字体缩放动画抖动问题及优化方案
flutter
yuanpan2 天前
认识跨平台UI框架Flutter和MAUI区别,如何选。
flutter·ui·maui
无知的前端2 天前
一文精通-Flutter 状态管理
flutter
阿笑带你学前端2 天前
Drift数据库开发实战:类型安全的SQLite解决方案
前端·flutter