在我的react-native 项目(react)中-native@0.60)在ios/dir中,我运行pod install并得到以下错误:

[!] Invalid `Podfile` file: no implicit conversion of nil into String.

 #  from /Users/coryrobinson/projects/hhs2/ios/Podfile:37
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

我没有在这个播客文件中添加或更改任何内容——都是react native生成的.(我在iOS开发方面没有经验,所以这可能是一个简单的解决方案,我只是不知道该找什么:-|)谢谢您的帮助!

这是我的播客文件

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'hhs2' do
  # Pods for hhs2
  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 'RNFS', :path => '../node_modules/react-native-fs'

  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'

  target 'hhs2Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'hhs2-tvOS' do
  # Pods for hhs2-tvOS

  target 'hhs2-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

推荐答案

以下是正确答案:

1-你的POD文件应该在顶部包含这一行

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

2-确保您的package.jsonnode_module文件夹已安装此模块

cli-platform-ios/native_modules

3-如果在运行yarn install后没有找到,则表示机器中有旧的缓存 node _模块,需要在重新安装软件包之前进行清理.

4-清除缓存yarn cache clean

5 - Make sure you have this file 100 and its configuration is VALID - and it doesn't have non-existing NPM packages - this step is LAST AND MOSTLY THE CAUSE of the error

我的react-native.config.js个例子

module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['./assets/fonts/'],
  dependencies: {}, // make sure this dependencies are all valid installed packages or empty if you don't need it
};

6-安装node packages yarn install,你的播客现在就可以工作了!pod install --repo-update

编码快乐!

React-native相关问答推荐

如何停止在Expo路由中将新文件显示为菜单列表?

如何在Recact Native中单击Back按钮后调用函数

在第二次加载时仅将本机应用程序设置为状态

react native调用fetch后如何使用Async Storage在本地保存数据?

每当我在 React Native Tab Navigator 中切换标签时触发 UseEffect

RNMK - 超级表达式必须为空或函数

react native HTML entities

React Native 响应式图像宽度,而图像的宽度/高度比保持不变

React 从 babel 6 到 babel 7 的原生升级

React Native:错误:找不到资源 android:style/TextAppearance.Material.Widget.Button.Borderless.Colored

Xcode 12 问题:Build input file cannot be found

如何使用功能组件向 ref 公开功能?

在配置 react-native-maps 中获取 "supportLibVersion" 、 "playServicesVersion" 和 "androidMapsUtilsVersion" 值

使用离线包在 iOS 设备上运行 react-native 应用程序

如何使用 Expo 在真实的 iOS 设备上运行应用程序?

react-navigation模式高度

降级 react-native 的适当机制

未找到 React/RCTBridgeDelegate.h' 文件

React Native 多行TextInput,文本居中

如何在react-native中验证 TextInput 值?