我是react-native
的新手,我已经使用以下命令通读了开始和安装cocoapods的文档:
sudo gem install cocoapods
这成功了。我正在使用以下提到的环境:
Mac OS 10.14.6
Xcode 11.3.1
CLT 11.3.1
Ruby 2.6.5
Cocoapods 1.9.3
现在,当我运行命令npx react-native init MyProject
时,我得到以下日志:
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for the iOS project, which is required by this template.
Please try again manually: "cd ./MyProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
再次,我从pod install
目录中尝试了命令ios
,得到了以下错误:
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
dyld: lazy symbol binding failed: Symbol not found: _ffi_prep_closure_loc
Referenced from: /Users/soumisar/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
Expected in: /usr/lib/libffi.dylib
dyld: Symbol not found: _ffi_prep_closure_loc
Referenced from: /Users/soumisar/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
Expected in: /usr/lib/libffi.dylib
Abort trap: 6
请告诉我,我要去哪里了。
答案 0 :(得分:0)
所以我找到了解决方法:
问题是在ruby中的这个glog
库(如上面的错误日志中所述)。在互联网上搜索有关问题Symbol not found: _ffi_prep_closure_loc
之所以出现,是因为在MacOS 10.14中,ffi
库可能是一个旧库,必须对其进行更新。安装最新的ffi库的命令是
gem inst ffi -- --disable-system-libffi
此命令对我有用。
或者另一个解决方案可能是升级MacOS 10.15(Catalina)
有关此问题的更多详细信息,请参见下面的链接