React
../node_modules/react-native
的podspec
我在成功安装npm后执行pod安装时遇到上述错误
NPM版本:5.6.0 以下是pod文件
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
react_native_path = '../node_modules/react-native'
pod 'Yoga', :path => "#{react_native_path}/ReactCommon/yoga"
pod 'React', :path => react_native_path, :subspecs => [
'Core',
'RCTText',
'RCTImage',
'DevSupport',
'BatchedBridge',
'RCTLinkingIOS',
'RCTAnimation',
'RCTActionSheet',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
端
答案 0 :(得分:2)
检查文件../node_modules/react-native/React.podspec
是否确实存在于Podfile
。如果没有,请检查package.json
是否真的包含react-native
作为依赖项。
对于标准RN项目目录结构,Podfile应放在<projectRoot>/ios/Podfile
中,如下所示:
platform :ios, '9.0'
target 'CGUI' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'RCTAnimation',
'RCTBlob',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTImage',
'RCTLinkingIOS',
'DevSupport',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
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 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
end
这是针对RN 0.51.0
答案 1 :(得分:0)
这对我有用。
答案 2 :(得分:0)
转到您的项目目录 在终端的IOS写命令打开Xcode
open ios/[projectname].xcworkspace
并从左侧导航栏中打开 Pods 文件夹并打开 Profile 文件 之后删除该行,
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
并重建项目。