记一次解决 ios Pod install Error 问题
跑 React native 时遇到如下错误
Installing yoga (0.60.5.React)
Generating Pods project
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/Users/tzmax/Software/ruby/bin/pod install --repo-update
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.8.4
Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
RubyGems : 2.5.2.3
Host : Mac OS X 10.6.6
Xcode : 11.3.1 (116605)
Git : git version 2.21.1 (Apple Git-122.3)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.1.0
cocoapods-trunk : 1.4.1
cocoapods-try : 1.1.0
```
### Podfile
```ruby
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'dongmiaomu' do
# Pods for dongmiaomu
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'Bytedance-UnionAD', '~> 2.4.6.7'
pod 'CodePush', :path => '../node_modules/react-native-code-push'
pod 'Picker', :path => '../node_modules/react-native-picker'
pod 'JPushRN', :path => '../node_modules/jpush-react-native'
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
#动态权限
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
target 'appTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'app-tvOS' do
# Pods for dongmiaomu-tvOS
target 'app-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
# 修复ios 的 react-native-config.
if target.name == 'react-native-config'
phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
phase.shell_script = "cd ../../"\
" && RNC_ROOT=./node_modules/react-native-config/"\
" && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
" && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
" && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"
target.build_phases << phase
target.build_phases.move(phase,0)
end
end
end
```
### Error
```
Errno::ENOENT - No such file or directory @ rb_sysopen - /data/app/ios/Pods/Local Podspecs/appcenter.podspec.json
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:646:in `read'
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/specification.rb:646:in `checksum'
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/lockfile.rb:533:in `block in generate_checksums'
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/lockfile.rb:532:in `each'
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/lockfile.rb:532:in `generate_checksums'
/Users/tzmax/Software/ruby/gems/cocoapods-core-1.8.4/lib/cocoapods-core/lockfile.rb:428:in `generate'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:744:in `generate_lockfile'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:752:in `write_lockfiles'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:299:in `generate_pods_project'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:173:in `integrate'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:162:in `install!'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Users/tzmax/Software/ruby/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Users/tzmax/Software/ruby/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/Users/tzmax/Software/ruby/bin/pod:22:in `load'
/Users/tzmax/Software/ruby/bin/pod:22:in `<main>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=No+such+file+or+directory+%40+rb_sysopen+-+%2Fdata%2Fapp%2Fdongmiaomu%2Fios%2FPods%2FLocal+Podspecs%2Fappcenter.podspec.json&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...
Found no similar issues. To create a new issue, please visit:
https://github.com/cocoapods/cocoapods/issues/new
这个问题的话好像是 1.8.4 版本有点坑导致的,我们安装 1.7.5 版本的 pod,就可以解决啦
gem uninstall cocoapods
gem install cocoapods -v 1.7.5