反应本机-Pod安装问题&无法加载此类file.node_modules/react-native/scripts/react_native_pods"

人气:420 发布:2022-10-16 标签: react-native cocoapods react-native-ios pod-install

问题描述

当我有一个Reaction本机项目.并且当我运行pod install时,它给出以下错误

Invalid `Podfile` file: cannot load such file -- /myPath/node_modules/react-native/scripts/react_native_pods

这是我的播客文件

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 'xs' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'xsTests' 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 'xs-tvOS' do
  # Pods for xs-tvOS

  target 'xs-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end
我已检查,位置myPath/node_modules/react-native/scripts/中没有名为react_native_pods的文件。 我想知道是否与npm install没有生成正确的文件有关.不过,我将节点升级到最新版本,然后运行npm install

推荐答案

我运行了npm audit fix,它添加了react_native_pods文件和pod install,然后工作

790