不变违规:无法找到 TurboModuleRegistry.getEnforcing 'RNCDatePicker'。验证是否已注册此名称的模块

问题描述 投票:0回答:2

在尝试使用“@react-native-community/datetimepicker”中的“DateTimePicker”时,出现以下错误。

错误不变违规:TurboModuleRegistry.getEnforcing(...):找不到“RNCDatePicker”。验证此名称的模块是否已在本机二进制文件中注册。,js 引擎:hermes 错误不变违规:“main”尚未注册。如果出现以下情况,就会发生这种情况:

  • Metro(本地开发服务器)从错误的文件夹运行。检查Metro是否正在运行,在当前项目中停止并重新启动它。
  • 由于错误,模块无法加载,并且未调用
    AppRegistry.registerComponent
    。,js 引擎:hermes

您可以在这里找到该项目https://github.com/mendismenon/md_reactnative

我按照下面的视频来实现此功能。 https://www.youtube.com/watch?v=UEfFjfW7Zes

android react-native datepicker expo datetimepicker
2个回答
1
投票

我想我发现了问题

仅与Android手机相关

您可以通过降级临时展览来修复它

npm install expo@^48.0.0

然后

npx expo install --fix 

0
投票

感谢迄今为止已回答的评论 - 我也能够修复此错误。

当我开始这个项目时,我收到了这个警告:

...
Starting Metro Bundler
Some dependencies are incompatible with the installed expo version:
  [email protected] - expected version: 13.9.0
  @react-native-community/[email protected] - expected version: 7.2.0
  @react-native-async-storage/[email protected] - expected version: 1.18.2
Your project may not work correctly until you install the correct versions of the packages.
Fix with: npx expo install --fix

按照人们的建议,我修改了我的 package.json,如下所示:

  "dependencies": {
    "expo": "~49.0.15",
    ....
    "@react-native-community/datetimepicker": "7.2.0",
    "@react-native-async-storage/async-storage": "1.18.2"
  },

基本上我所做的就是降级 datetimepicker 和 async-storage 的版本以匹配警告消息中的版本。

然后我就跑了:

npx expo install --fix 
npm install 

这解决了我的问题。祝你好运!

© www.soinside.com 2019 - 2024. All rights reserved.