ios - 运行 pod install : Invalid attribute name 时出错

标签 ios react-native cocoapods

我正在使用 React Native (0.60.4) 和 cocoapods (1.7.5)。当我 cd 进入我的 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 install,这最终发生了。似乎 Podfile 中存在我没有注意到的语法问题?如果有人能指出这可能是什么的大致方向,我将不胜感激。谢谢!

最佳答案

卸载 cocoa pods(所有版本),然后进行全新安装。

为 react-native 和 try pod 命令创建一个测试项目,如果一切正常,然后在实际项目上尝试(先备份代码)。

关于ios - 运行 pod install : Invalid attribute name 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57748955/

相关文章:

ios - iOS 上的实际风景 OpenGL View

ios - 释放触摸时 UISlider 过于敏感

view - React-Native : measure a View

android - Android Studio-Gradle “Sync now”不可用

xcode - Xcode 8警告:没有规则可以处理架构x86_64的net.daringfireball.markdown类型的文件

ios - `master` 仓库需要 CocoaPods 0.18.1 -

ios - 对 arc4random() 施加限制?

ios - 我在 iOS 中收到错误的通知时间?

javascript - react /Redux : modified state is not updated in view

ios - 解析实时查询 cocoapods 和 Swift 3