我创建了一个新的 React Native 项目,然后安装 npm ,运行命令 bundle install ,然后 cd iOS pod install 但它卡住了
Installing React-perflogger (0.71.2)
Installing React-runtimeexecutor (0.71.2)
Installing ReactCommon (0.71.2)
Installing SocketRocket (0.6.0)
Installing TOCropViewController (2.6.1)
Installing Yoga (1.14.0)
Installing YogaKit (1.18.1)
Installing boost (1.76.0)
Installing fmt (6.2.1)
Installing glog (0.3.5)
Installing hermes-engine (0.71.2)
Run Code Online (Sandbox Code Playgroud)
这是我的 package.json 文件
{
"name": "ApproverApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.16.1",
"@react-navigation/bottom-tabs": "^6.2.0", …
Run Code Online (Sandbox Code Playgroud) 当我有一个本机项目时......当我运行pod install
它时,它给了我以下错误
Invalid `Podfile` file: cannot load such file -- /myPath/node_modules/react-native/scripts/react_native_pods
Run Code Online (Sandbox Code Playgroud)
这是我的 podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'xs' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'xsTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'xs-tvOS' do
# Pods for xs-tvOS …
Run Code Online (Sandbox Code Playgroud) 我刚刚开始学习react-native。在尝试运行时npx pod-install
我得到:
Scanning for pods...\n1.11.3\n> pod install\nAuto-linking React Native modules for target `AudioOnlyRN`: RNCAsyncStorage, RNCClipboard, react-native-background-timer, react-native-daily-js, and react-native-webrtc\n[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json\n\n[!] Invalid `Podfile` file: no implicit conversion of nil into String.\n\n # from /.../react-native/ios/Podfile:9\n # -------------------------------------------\n #\n > use_react_native!(:path => config["reactNativePath"])\n #\n # -------------------------------------------\nCouldn't install Pods. Updating the Pods project and trying again...\n> pod install --repo-update\nAuto-linking React Native modules for target `AudioOnlyRN`: RNCAsyncStorage, RNCClipboard, react-native-background-timer, react-native-daily-js, and react-native-webrtc\n[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json\n\n[!] Invalid `Podfile` file: no implicit conversion of …
Run Code Online (Sandbox Code Playgroud) 上下文:我正在尝试使用react-native-video
. iOs 安装说明以npx pod-install
.
跑步:
npx pod-install
Run Code Online (Sandbox Code Playgroud)
返回:
npx: installed 1 in 1.113s
Scanning for pods...
CocoaPods is not supported in this project
Run Code Online (Sandbox Code Playgroud)
输出消息对我还没有帮助。所以我去了npm pod-install。看起来它抽象了 CocoaPods 和 gem 复杂性。
有没有比学习 CocoaPods 和 gem 更简单的方法来解决这个问题?
包.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~37.0.3",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-video": "^4.4.5",
"react-native-web": "~0.11.7"
}, …
Run Code Online (Sandbox Code Playgroud) 当我开始 pod install 结果时:
[!] CocoaPods 找不到 pod "React/Core" 的兼容版本:在 Podfile 中:react-native-fetch-blob (from ../node_modules/react-native-fetch-blob
) 已解析为 0.10.6,这取决于 React/Core
您的规范来源都不包含满足依赖项的规范:React/Core
.
你有:
我尝试修复 pod repo update* + pod update remove podfile.lock 仍然无法正常工作,感谢提前 pod 文件是:
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'delivery_partner' do
# Pods for delivery_partner
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => …
Run Code Online (Sandbox Code Playgroud)[!] 处理 Podfile 的安装后挂钩时发生错误。
[Xcodeproj] 一致性问题:对象没有父对象RNPlaceholder.swift
:SourcesBuildPhase
,SourcesBuildPhase
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project/object/helpers/groupable_helper.rb:19:in parent' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project/object/build_file.rb:71:in
ascii_plist_annotation' /Library/Ruby/Gems/2.6.0/gems /xcodeproj-1.19.0/lib/xcodeproj/project.rb:296 block in to_ascii_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:295:in
:在每个'/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:295:into_ascii_plist' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:364:in
保存中的块' /Library/Ruby/Gems/2.6.0/gems/atomos-0.1.3/lib/atomos.rb:21:in block in atomic_write' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tempfile.rb:295:in
open' /Library/Ruby/Gems/2.6.0/gems/atomos-0.1 .3/lib/atomos.rb:17:在atomic_write' /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.19.0/lib/xcodeproj/project.rb:363:in
保存'/Users/lwillia5/Documents/ebw/DJRainMobileApp/node_modules/react-native/scripts/react_native_pods.rb:136:在block in exclude_architectures' /Users/lwillia5/Documents/ebw/DJRainMobileApp/node_modules/react-native/scripts/react_native_pods.rb:127:in
每个'/Users/lwillia5/Documents/ebw /DJRainMobileApp/node_modules/react-native/scripts/react_native_pods.rb:127 exclude_architectures' /Users/lwillia5/Documents/ebw/DJRainMobileApp/node_modules/react-native/scripts/react_native_pods.rb:145:in
:在react_native_post_install' /Users/lwillia5/Documents/ebw/DJRainMobileApp/ios/Podfile:28:在block (3 levels) in from_ruby' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:179:in
post_install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:897 run_podfile_post_install_hook' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:885:in
:在 run_podfile_post_install_hooks' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10 中的块中.1/lib/cocoapods/user_interface.rb:145:在message' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:884:in
run_podfile_post_install_hooks'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:329 block (2 levels) in create_and_save_projects' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in
:写入!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:328 block in create_and_save_projects' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in
:在部分'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1 /lib/cocoapods/installer.rb:307 create_and_save_projects' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:299:in
:在generate_pods_project' …
我在安装 pod 时收到以下错误。
The name of the given podspec `Yoga` doesn't match the expected one `yoga`
Run Code Online (Sandbox Code Playgroud)
在 Podfile 中,这些是唯一带有“yoga”一词的行,并且它们是小写的......所以我不知道是什么导致了这个问题......
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
Run Code Online (Sandbox Code Playgroud)
怎么解决?
我在我的本机项目中安装了这样的 firebase-->
yarn add @react-native-firebase/database
Run Code Online (Sandbox Code Playgroud)
然后当我尝试使用此命令根据文档安装 pod 时 -->
cd ios/ && pod install && cd ..
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
> [!] Invalid `Podfile` file: [!] Invalid `RNFBDatabase.podspec` file:
> No such file or directory @ rb_sysopen - ../app/package.json.
Run Code Online (Sandbox Code Playgroud) cocoapods firebase react-native firebase-realtime-database pod-install