React Native 无效的`Podfile`文件:无法加载该文件

lokaqttq  于 6个月前  发布在  React
关注(0)|答案(3)|浏览(75)

我得到的ios文件夹,并使用“豆荚安装”命令。
下面的错误

[!] Invalid `Podfile` file: cannot load such file -- /Users/blabla/works/blabla-app/node_modules/react-native/scripts/react_native_pods.

  from /Users/blabla/works/blabla-app/ios/Podfile:2
   -------------------------------------------
   require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
   require_relative '../node_modules/react-native/scripts/react_native_pods'
   
   -------------------------------------------

字符串
我删除了node_modules文件夹,我删除了package-lock.json并使用“npm install”命令。我删除了cocoapods并重新安装。
但对我来说什么都不管用。
我的package.json文件在下面(只有包,不是全部)

"@codler/react-native-keyboard-aware-scroll-view": "^1.0.1",
"axios": "^0.19.0",
"entities": "^2.1.0",
"expo": "^38.0.8",
"expo-cli": "^3.28.5",
"native-base": "github:Healthyco/NativeBase#feature/fix-request-animation",
"native-base-autocomplete": "^1.3.2",
"prop-types": "^15.7.2",
"react": "16.9.0",
"react-native": "0.62.0",
"react-native-camera": "^3.40.0",
"react-native-camera-hooks": "^0.3.1",
"react-native-chart-kit": "^6.7.0",
"react-native-daterange-picker": "^1.4.0",
"react-native-gesture-handler": "^1.3.0",
"react-native-keyboard-aware-scroll-view": "https://github.com/APSL/react-native-keyboard-aware-scroll-view#fb40649a9c84aa23d6a55355e9e0e432795967a6",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-masked-text": "^1.13.0",
"react-native-modal": "^11.5.6",
"react-native-safe-area-context": "~3.0.7",
"react-native-screens": "^2.7.0",
"react-native-svg": "^12.1.0",
"react-native-swipe-list-view": "^3.2.5",
"react-native-vector-icons": "^7.1.0",
"react-navigation": "^3.11.2",
"react-redux": "^7.2.0",
"redux": "^4.0.1",
"redux-persist": "^5.10.0",
"redux-saga": "^1.0.2",
"reduxsauce": "^1.0.1",
"victory-native": "^35.3.1"


我的podfile:我记得,我从React63.2降级到62.0

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

platform :ios, '10.0'

target 'blabla' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  pod 'RNSVG', :path => '../node_modules/react-native-svg'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  target 'blablaTests' 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 'blabla-tvOS' do
  # Pods for [YourProjectName]-tvOS

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

fzsnzjdm

fzsnzjdm1#

您可能缺少react-native npm模块。
您应该使用以下命令将其包含在packages.json中,以减少将来遇到此错误的可能性。

$ npm install --save react-native

字符串

insrf1ej

insrf1ej2#

对我有效的是删除ios目录,然后再次运行build命令,即:

rm -rf ios
eas build -p ios

字符串
(or无论你使用的是什么命令)

ej83mcc0

ej83mcc03#

我在尝试阅读React Native的Setting up the development environment指南时遇到了同样的问题,并尝试了以下方法,但无济于事:

最终修复它的是this advice在VSCode上禁用自动连接。

相关问题