我正在使用React Native(0.60.4)和cocoapods(1.7.5)。当我进入ios文件夹并运行pod install时,出现以下错误:
[!] Invalid `Podfile` file: [!] /Users/stephensmac_air/Documents/WeeklyTasks/node_modules/.bin/react-native config
Error: Invalid attribute name
Line: 36
Column: 18
Char: .
at error (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/xmldoc/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/xmldoc/node_modules/sax/lib/sax.js:692:7)
at SAXParser.write (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/xmldoc/node_modules/sax/lib/sax.js:1324:13)
at new XmlDocument (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/xmldoc/lib/xmldoc.js:199:15)
at readManifest (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/@react-native-community/cli-platform-android/build/config/readManifest.js:44:10)
at Object.projectConfig (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/@react-native-community/cli-platform-android/build/config/index.js:60:46)
at Object.get project [as project] (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/@react-native-community/cli/build/tools/config/index.js:134:65)
at /Users/stephensmac_air/Documents/WeeklyTasks/node_modules/@react-native-community/cli/build/commands/config/config.js:8:452
at Array.forEach (<anonymous>)
at _objectSpread (/Users/stephensmac_air/Documents/WeeklyTasks/node_modules/@react-native-community/cli/build/commands/config/config.js:8:392)
我的ios文件夹中的Podfile如下:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'WeeklyTasks' do
# Pods for WeeklyTasks
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-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
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 '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 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'
target 'WeeklyTasksTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'WeeklyTasks-tvOS' do
# Pods for WeeklyTasks-tvOS
target 'WeeklyTasks-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
有人知道这个错误要说什么吗?在此之前,我尝试实现推送通知,并且我需要运行Pod安装,并且最终发生了这种情况。似乎Podfile中存在语法问题,我没有注意到?如果有人能指出我可能的大致方向,我将不胜感激。谢谢!
最佳答案
卸载可可豆荚(所有版本),然后重新安装。
为react-native和try pod命令创建一个测试项目,如果一切正常,请尝试实际的项目(首先保留代码备份)。
关于ios - 运行Pod安装时出错:无效的属性名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57748955/