我刚刚更新到RN v0.62,并且在iOS上运行应用程序后出现以下错误
!] CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker":
In snapshot (Podfile.lock):
ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
In Podfile:
ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
None of your spec sources contain a spec satisfying the dependency: `ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)`.
我删除了所有的node_modules并做了npm i。我也在iOS目录中安装了Pod,但问题仍然存在。我也做了pod repo更新。
答案 0 :(得分:331)
对于React native
0.62版本
所以我想通了
替换Podfile中的下一行
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
使用
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
编辑:
如果您已更新至React Native
0.63版
从iOS文件夹中删除Podfile.lock
。
做npm i
从iOS文件夹打开podfile
删除所有内容并复制以下内容
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'
platform :ios, '10.0'
target 'RNTodo' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'RNTodoTests' 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 'RNTodo-tvOS' do
# Pods for RNTodo-tvOS
target 'RNTodo-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
用您自己的项目名称替换RNTodo
,在终端中将cd替换为iOS文件夹,然后执行pod install
,一切都会正常工作
RN
0.63也不再支持iOS 9
答案 1 :(得分:42)
我通过更改<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<div class="ui-bar-a" id="myButton" style="bottom:0;position: fixed;width: 100%">
<input type="submit" name="Next" id="NextButton" value="Save" />
</div>
中的行,解决了这个问题(版本0.63)
Podfile
到
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
答案 2 :(得分:34)
我认为jscallinvoker
版本已过时,请尝试替换
jscallinvoker
到
callinvoker
答案 3 :(得分:16)
在将React Native
升级到版本0.63.0
之后,我的项目会发生此问题,因此对于解决方案,我只删除了Podfile.lock
并删除了整个Podfile
并添加了新内容来自最新版本的全新安装的React Native项目,这意味着其内容应为:
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'
platform :ios, '10.0'
target '[YourProjectName]' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target '[YourProjectName]Tests' 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 '[YourProjectName]-tvOS' do
# Pods for [YourProjectName]-tvOS
target '[YourProjectName]-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
注意:很明显,您应该将项目名称替换为[YourProjectName]
。
之后,在项目的根目录上运行npx pod-install
命令,一切将恢复正常。
答案 4 :(得分:12)
RN 0.63不再支持iOS 9
因此在pod文件中 替换
和
转到终端运行中的ios文件夹
答案 5 :(得分:11)
如果任何人仍无法使用React Native版本0.63.0,那么这对我有用
按如下方式更新callinvoker窗格
pod 'React-callinvoker', :path => "#{rnPrefix}/ReactCommon/callinvoker"
答案 6 :(得分:8)
在RN 0.63.0中,您可以Yes Yes No
删除所有RN吊舱,而只需在目标中包含以下几行即可。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.clock {
&-day {
&:before {
content: var(--timer-day);
}
}
&-hours {
&:before {
content: var(--timer-hours);
}
}
&-minutes {
&:before {
content: var(--timer-minutes);
}
}
&-seconds {
&:before {
content: var(--timer-seconds);
}
}
}
body {
background: linear-gradient(45deg, #1870ed 0, #f18f88 100%);
font-family: 'Montserrat', 'sans-serif';
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.clock {
&-container {
margin-top: 30px;
margin-bottom: 30px;
background-color: #080808;
border-radius: 5px;
padding: 60px 20px;
box-shadow: 1px 1px 5px rgba(255,255,255,.15), 0 15px 90px 30px rgba(0,0,0,.25);
display: flex;
}
&-col {
text-align: center;
margin-right: 40px;
margin-left: 40px;
min-width: 90px;
position: relative;
&:not(:last-child):before,
&:not(:last-child):after{
content: "";
background-color: rgba(255,255,255,.3);
height: 5px;
width: 5px;
border-radius: 50%;
display: block;
position: absolute;
right: -42px;
}
&:not(:last-child):before {
top: 35%;
}
&:not(:last-child):after {
top: 50%;
}
}
&-timer {
&:before {
color: #fff;
font-size: 4.2rem;
text-transform: uppercase;
}
}
&-label {
color: rgba(255,255,255,.35);
text-transform: uppercase;
font-size: .7rem;
margin-top: 10px;
}
}
@media (max-width: 825px) {
.clock-container {
flex-direction: column;
padding-top: 40px;
padding-bottom: 40px;
}
.clock-col {
& + & {
margin-top: 20px;
}
&:before,
&:after {
display: none!important;
}
}
}
</style>
</head>
<body>
<div class="clock-container">
<div class="clock-col">
<p class="clock-hours clock-timer">
</p>
<p class="clock-label">
Hours
</p>
</div>
<div class="clock-col">
<p class="clock-minutes clock-timer">
</p>
<p class="clock-label">
Minutes
</p>
</div>
<div class="clock-col">
<p class="clock-seconds clock-timer">
</p>
<p class="clock-label">
Seconds
</p>
</div>
</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () =>
requestAnimationFrame(updateTime)
)
function updateTime() {
document.documentElement.style.setProperty('--timer-day', "'" + moment().format("dd") + "'");
document.documentElement.style.setProperty('--timer-hours', "'" + moment().format("k") + "'");
document.documentElement.style.setProperty('--timer-minutes', "'" + moment().format("mm") + "'");
document.documentElement.style.setProperty('--timer-seconds', "'" + moment().format("ss") + "'");
requestAnimationFrame(updateTime);
}
</script>
</body>
</html>
还需要在podfile
开头的平台行之后添加此行:
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
此后,删除podfile
目录,require_relative '../node_modules/react-native/scripts/react_native_pods'
和工作区文件。然后只需Pods
。
答案 7 :(得分:4)
React-Native现在正在动态配置Pod,因此您不再需要列出每个Pod;
use_react_native!(:path => config [“ reactNativePath”])
这是从63.1基本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 'test' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'testTests' do
inherit! :complete
end
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'test-tvOS' do
target 'test-tvOSTests' do
inherit! :search_paths
end
end
答案 8 :(得分:2)
如果您已经有 callinvoker ,但仍然有错误。这种操作帮助了我:
react-native start --reset-cache
rm -rf node_modules/
rm -rf package-lock.json
cd ios
pod deintegrate
cd ..
rm -rf ios/Podfile.lock
npm install
npm audit fix
react-native link
cd ios
pod install
cd ..
react-native run-ios
答案 9 :(得分:2)
根据https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.2进行手动调整可能会有所帮助。
然后,您将必须运行命令cd ios && pod install
。
答案 10 :(得分:2)
在将 Expo裸机工作流程从0.38(RN 0.62)升级到0.39(具有RN 0.63)时,解决了此问题。 @Pritish的编辑答案确实有效,但是它表示此错误
[!] Unable to find a target named `RNTodo-tvOS` in project `RNTodo.xcodeproj`, did find `RNTodo`.
和
[!] Unable to find a target named `RNTodoTests` in project `RNTodo.xcodeproj`, did find `RNTodo`.
通过更改如下所示的Podfile获得解决方法
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'daytodiary' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# 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
发生了什么变化?
ADD unimodule在顶部
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
在use_unimodules!
之前添加config = use_native_modules!
。
删除
target '[YourProjectName]Tests' do
inherit! :complete
# Pods for testing
end
删除
target 'RNTodo-tvOS' do
# Pods for RNTodo-tvOS
target 'RNTodo-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
对于 Android (如果升级后出现错误)
在android/build.gradle
中
更改
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
}
收件人
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
}
答案 11 :(得分:1)
platform :ios, '11.0'
我通过如下更改解决了这个问题(版本 0.63.4)
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
# Maybe someone is
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
↓
pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"