出现场景
新电脑运行一个老Flutter项目,flutter run
运行ios出现以下报错。
Launching lib/main.dart on iPhone in debug mode...
Upgrading AppFrameworkInfo.plist
Upgrading Podfile
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Upgrading Info.plist
Removing script build phase dependency analysis.
Automatically signing iOS for device deployment using specified development team in Xcode project: YE6STNG83Y
Running pod install...
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
- Flutter
- device_info
- flutter_compass
- flutter_reactive_ble
- fluttertoast
- location_permissions
- shared_preferences
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `device_info` from `.symlinks/plugins/device_info/ios`
-> Fetching podspec for `flutter_compass` from `.symlinks/plugins/flutter_compass/ios`
-> Fetching podspec for `flutter_reactive_ble` from `.symlinks/plugins/flutter_reactive_ble/ios`
-> Fetching podspec for `fluttertoast` from `.symlinks/plugins/fluttertoast/ios`
-> Fetching podspec for `location_permissions` from `.symlinks/plugins/location_permissions/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: all_pods_versions_e_c_d.txt exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/e/c/d/Protobuf/3.23.1/Protobuf.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: all_pods_versions_4_a_9.txt exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/4/a/9/SwiftProtobuf/1.21.0/SwiftProtobuf.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path downloaded: all_pods_versions_5_1_0.txt, save ETag: W/"647d3427-442"
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/2.0/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/2.0/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/2.1/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/2.1/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/2.2/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/2.2/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/2.3/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/2.3/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/2.4/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/2.4/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/3.0/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/3.0/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/3.1.0/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/3.1.0/Toast.podspec.json
CDN: trunk Redirecting from https://cdn.cocoapods.org/Specs/5/1/0/Toast/4.0.0/Toast.podspec.json to https://cdn.jsdelivr.net/cocoa/Specs/5/1/0/Toast/4.0.0/Toast.podspec.json
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/3.0/Toast.podspec.json, save ETag: W/"1e0-MsWSKav89BhQFiuDu5JZ3IQ3JHM"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/2.0/Toast.podspec.json, save ETag: W/"1e1-XMAmeOSWaQhWFkqknINNBeT7MU8"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/4.0.0/Toast.podspec.json, save ETag: W/"207-kbOWxW7nKleQgW9A06lN01erwZY"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/2.4/Toast.podspec.json, save ETag: W/"1e0-B3O4/A6XNSymBUUXvsfr3UEQAp0"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/2.2/Toast.podspec.json, save ETag: W/"1e1-0iSflVSJlWXJ5b3RwLwOStN29ZI"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/2.3/Toast.podspec.json, save ETag: W/"1e0-T5NYYMAtVHrj9RTZ/AbCWriM+Fg"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/2.1/Toast.podspec.json, save ETag: W/"1e1-KkXNE+hQimz2mT48zU8twidPLos"
CDN: trunk Relative path downloaded: Specs/5/1/0/Toast/3.1.0/Toast.podspec.json, save ETag: W/"1e4-FKk2htbIv+Jyev00JBTjVmCoofM"
CDN: trunk Relative path: Specs/5/1/0/Toast/4.0.0/Toast.podspec.json modified during this run! Returning local
CDN: trunk Relative path: Specs/e/c/d/Protobuf/3.14.0/Protobuf.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/4/a/9/SwiftProtobuf/1.15.0/SwiftProtobuf.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/5/1/0/Toast/4.0.0/Toast.podspec.json modified during this run! Returning local
Comparing resolved specification to the sandbox manifest
A Flutter
A Protobuf
A SwiftProtobuf
A Toast
A device_info
A flutter_compass
A flutter_reactive_ble
A fluttertoast
A location_permissions
A shared_preferences
Downloading dependencies
-> Installing Flutter (1.0.0)
-> Installing Protobuf (3.14.0)
> Git download
> Git download
$ /usr/bin/git clone https://github.com/protocolbuffers/protobuf.git /var/folders/1y/x4fgnssn2y97hys92bsdyw2w0000gn/T/d20230605-5720-hackl6 --template= --single-branch --depth 1 --branch v3.14.0
[!] Error installing Protobuf
[!] /usr/bin/git clone https://github.com/protocolbuffers/protobuf.git /var/folders/1y/x4fgnssn2y97hys92bsdyw2w0000gn/T/d20230605-5720-hackl6 --template= --single-branch --depth 1 --branch v3.14.0
Cloning into '/var/folders/1y/x4fgnssn2y97hys92bsdyw2w0000gn/T/d20230605-5720-hackl6'...
fatal: unable to access 'https://github.com/protocolbuffers/protobuf.git/': LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:144:in `rescue in execute_command'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:141:in `execute_command'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/base.rb:175:in `block in executable'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/git.rb:107:in `block in clone'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:175:in `block in ui_sub_action'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:174:in `ui_sub_action'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/git.rb:105:in `clone'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/git.rb:73:in `download!'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/base.rb:83:in `block in download'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:159:in `block in ui_action'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:158:in `ui_action'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-downloader-1.6.3/lib/cocoapods-downloader/base.rb:81:in `download'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:110:in `download_source'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:77:in `download_request'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader/cache.rb:256:in `download'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader/cache.rb:239:in `block in uncached_pod'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader/cache.rb:266:in `in_tmpdir'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader/cache.rb:238:in `uncached_pod'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/downloader.rb:42:in `download'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/pod_source_downloader.rb:69:in `download!'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/pod_source_installer.rb:117:in `download_source'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/pod_source_installer.rb:67:in `install!'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:621:in `install_source_of_pod'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:539:in `block (2 levels) in install_pod_sources'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:538:in `block in install_pod_sources'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:535:in `each'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:535:in `install_pod_sources'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:258:in `block in download_dependencies'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:257:in `download_dependencies'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:163:in `install!'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
/Users/surecall/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
/Users/surecall/.rvm/rubies/ruby-3.0.0/bin/pod:23:in `load'
/Users/surecall/.rvm/rubies/ruby-3.0.0/bin/pod:23:in `<main>'
/Users/surecall/.rvm/rubies/ruby-3.0.0/bin/ruby_executable_hooks:22:in `eval'
/Users/surecall/.rvm/rubies/ruby-3.0.0/bin/ruby_executable_hooks:22:in `<main>'
Error output from CocoaPods:
↳
Cloning into '/var/folders/1y/x4fgnssn2y97hys92bsdyw2w0000gn/T/d20230605-5720-hackl6'...
fatal: unable to access 'https://github.com/protocolbuffers/protobuf.git/': LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60
[!] Automatically assigning platform `iOS` with version `11.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Exception: Error running pod install
解决方案
根据错误提示,是因为pod安装protocolbuf的依赖时,下载超时导致的,所以我们只需要能确保我们的网络能正常下载github的库就行。
fatal: unable to access 'https://github.com/protocolbuffers/protobuf.git/': LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60
配置命令行代理
将以下配置复制到环境变量中(我的是~/.zshrc),最后的端口口改成自己软件的代理端口。
alias proxy="
export https_proxy=http://127.0.0.1:7890;
export http_proxy=http://127.0.0.1:7890;
export all_proxy=socks5://127.0.0.1:7890;"
# export http_proxy=socks5://127.0.0.1:7890;
# export https_proxy=socks5://127.0.0.1:7890;
# export all_proxy=socks5://127.0.0.1:7890;
# export no_proxy=socks5://127.0.0.1:7890;
# export HTTP_PROXY=socks5://127.0.0.1:7890;
# export HTTPS_PROXY=socks5://127.0.0.1:7890;
# export ALL_PROXY=socks5://127.0.0.1:7890;
# export NO_PROXY=socks5://127.0.0.1:7890;"
alias unproxy="
unset http_proxy;
unset https_proxy;
unset all_proxy;
unset no_proxy;
unset HTTP_PROXY;
unset HTTPS_PROXY;
unset ALL_PROXY;
unset NO_PROXY"
保存文件,使用source ~/.zshrc
使配置生效。
重新运行flutter run
,很快pod install就成功了。
aaa@aaadeMacBook-Air horizon % flutter run
Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: ED93LDE843P
Running pod install... 10.6s
Running Xcode build...
Xcode build done. 12.3s