每当我使用REACT-Native Run-iOS运行我的Reaction本地应用程序时,我都会收到以下错误:

错误:无法从./Libraries/Components/DatePicker/DatePickerIOS解析模块/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/react-native/index.js:

这些文件都不存在: Node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx) Node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx) 15|从‘./Libraries/Components/ActivityIndicator/ActivityIndicator’;导入活动指示器的类型 16|从‘./库/组件/按钮’导入类型的按钮; 17|从‘./Libraries/Components/DatePicker/DatePickerIOS’;导入类型的DatePickerIOS |^ 18|从‘./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid’;导入类型的DrawerLayout Android 19|从‘./Library/List/FlatList’导入类型的FlatList; 20|从‘./库/图像/图像’导入类型的图像; 在模块Resolver.ResolveDependency(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:107:15) 在DependencyGraph.ResolveDependency(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph.js:288:43) 在对象.解析(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/lib/transformHelpers.js:129:24) 在Resolve(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33) 在/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26 在Array.Reduce() 解析时依赖项(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33) 在ProcedModule(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31) 在异步添加依赖项(/Users/antonhorl3/WebstormProjects/sagly/client/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18) At Async Promise.all(索引0)`

我没有对我的代码做任何更改,问题就这样出现了.我确实更新了Xcode,这是我认为我所做的唯一更改.我很迷茫.

react 本机模块中的IMPORT语句是正确的,并且该文件确实存在.

这就是我的环境:

 System:
    OS: macOS 13.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 40.24 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.1.2 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 23, 26, 29, 30, 31
      Build Tools: 19.1.0, 23.0.1, 23.0.3, 27.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: 5.0.1-alpha.2 => 5.0.1-alpha.2 
    react: 18.0.0-rc.0 => 18.0.0-rc.0 
    react-native: 0.65.3 => 0.65.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

如果您需要更多信息,我很乐意添加或编辑我的问题.

谢谢你的帮助.

我try 了以下几点:

  • 重新启动我的笔记本电脑
  • react 本机启动-重置缓存
  • Rm-rf/tmp/metro-*
  • Yarn 开始--重置-缓存
  • 守望者守望一切
  • 删除NODE_MODULES并重新安装它们

应用程序运行时应该不会出现此错误.

这是我的Package.json:

{
  "name": "client",
  "version": "0.0.1",
  "private": true,
  "rnpm": {
    "assets": [
      "assets/fonts"
    ]
  },
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "1.2.36",
    "@fortawesome/free-solid-svg-icons": "5.15.4",
    "@fortawesome/react-native-fontawesome": "0.2.7",
    "@invertase/react-native-apple-authentication": "2.1.5",
    "@notifee/react-native": "^5.2.1",
    "@react-native-async-storage/async-storage": "1.15.14",
    "@react-native-community/cli": "5.0.1-alpha.2",
    "@react-native-community/masked-view": "0.1.11",
    "@react-native-community/netinfo": "7.1.7",
    "@react-native-firebase/app": "^14.8.0",
    "@react-native-firebase/messaging": "^14.8.0",
    "@react-native-google-signin/google-signin": "7.0.1",
    "@react-native-picker/picker": "^1.8.3",
    "@react-navigation/native": "6.0.2",
    "@react-navigation/stack": "5.14.4",
    "i18next": "^21.8.14",
    "jwt-decode": "3.1.2",
    "lodash": "4.17.21",
    "moment": "^2.29.4",
    "raygun4reactnative": "1.1.5",
    "react": "18.0.0-rc.0",
    "react-i18next": "^11.18.1",
    "react-native": "0.65.3",
    "react-native-android-keyboard-adjust": "1.2.0",
    "react-native-codegen": "0.0.7",
    "react-native-eject": "^0.2.0",
    "react-native-elements": "3.3.2",
    "react-native-fast-image": "^8.6.3",
    "react-native-fs": "^2.19.0",
    "react-native-gesture-handler": "1.10.3",
    "react-native-google-mobile-ads": "^9.1.1",
    "react-native-iap": "^12.8.3",
    "react-native-image-picker": "^4.7.3",
    "react-native-image-resizer": "^1.4.5",
    "react-native-in-app-review": "^4.1.1",
    "react-native-localize": "^2.2.2",
    "react-native-offline": "^6.0.0",
    "react-native-purchases": "^5.13.0",
    "react-native-ratings": "^8.1.0",
    "react-native-responsive-screen": "1.4.2",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "3.6.0",
    "react-native-searchable-dropdown": "^1.1.3",
    "react-native-share": "^7.3.6",
    "react-native-snap-carousel": "3.9.1",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "12.1.1",
    "react-native-triangle": "^0.0.9",
    "react-native-vector-icons": "8.1.0",
    "react-native-view-shot": "^3.1.2",
    "react-native-webview": "11.6.4",
    "react-native-wheel-scroll-picker": "^0.2.4",
    "react-native-youtube-iframe": "2.1.0",
    "react-navigation": "4.4.4",
    "react-navigation-stack": "2.10.4",
    "styled-components": "^5.3.5",
    "tcomb-form-native": "0.6.20"
  },
  "devDependencies": {
    "@babel/core": "^7.18.9",
    "@babel/runtime": "7.13.10",
    "@react-native-community/eslint-config": "2.0.0",
    "babel-jest": "26.6.3",
    "eslint": "7.23.0",
    "jest": "26.6.3",
    "metro-react-native-babel-preset": "0.65.2",
    "react-native-clean-project": "^4.0.1",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

推荐答案

XCode版本14.3存在一个已知问题.请参见https://github.com/facebook/react-native/issues/36635.

Ios相关问答推荐

Firebase SDK 10+—无法安装软件包

SwiftUI拖动手势和内容拖动时的奇怪行为( skip /卡顿)

如何创建自定义组件来接受(和传递)所有可能的Textfield参数?

滚动时突出显示工具栏项目

OnTapGesture在其修改的视图外部触发

GraphQL iOS Apollo客户端自动持久化查询导致崩溃

WatchConnectivity - 从手表配套应用程序在 iOS 设备上启动 AVPlayer

创建方案时运行 pod install 时出错

ionic 4 - 编译 ios - 来自项目Pods的目标GoogleDataTransport中的问题

如何在 SwiftUI 中将选项卡放在滚动视图中?

有没有办法访问自动生成的 Codable 一致性的编码键?

用溢出的长文本对齐 Flutter 中的行和列

在 Grand Central Dispatch 中使用 dispatch_sync

iOS 10 / Xcode 8 设备上的 NSLog 似乎被截断了?为什么?

UIButton 事件.有什么不同?

如何确定 WKWebView 的内容大小?

在 UITableViewController 中使用 UISearchDisplayController 时断言失败

ARC - __unsafe_unretained 的含义?

如何为 NSDate 添加一个月?

在自动布局中居中子视图的 X 会引发未准备好约束