升级到 0.39 版后未构建 React-native [英] React-native not building after upgrade to version 0.39

查看:52
本文介绍了升级到 0.39 版后未构建 React-native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android 上将项目升级到 0.39 版后,我得到:错误:需要未知模块0".如果您确定模块在那里,请尝试重新启动打包程序或运行npm install"".在 iOS 上:

After upgrade project to version 0.39 on Android im getting: Error: Requiring unknown module "0". If you sure module is there, try restarting the packager or running "npm install"". And on iOS:

2016-12-27 12:08:14.802 [info][tid:main][RCTBatchedBridge.m:72] Initializing <RCTBatchedBridge: 0x608000380750> (parent: <RCTBridge: 0x6080000a5d00>, executor: RCTJSCExecutor)
2016-12-27 12:08:15.749 [warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:505] Failed to execute source code: Unhandled JS Exception: Error
2016-12-27 12:08:15.750 [fatal][tid:main] Unhandled JS Exception: Error
2016-12-27 12:08:15.751 [98772:687954] -[RCTJSStackFrame objectForKeyedSubscript:]: unrecognized selector sent to instance 0x60000004f6f0

推荐答案

您的本机代码和 JavaScript 代码可能不匹配.清除所有缓存,以便构建和运行干净的应用程序:

You probably have a mismatch between your native code and your JavaScript code. Clear out all your caches so that you are building and running a clean app:

  • 删除您的 node_modules 文件夹并再次运行npm install"(如果您希望这一步更快,则使用 yarn).确保 package.json 指定了您期望的最新版本的 React Native.
  • 删除您的 Androidbuild"文件夹(git clean -dfxn"可能有助于找到它们)和您的全局 iOSDerivedData"文件夹(许多在线指南)
  • 从 iOS 模拟器或 iPhone 卸载您的应用
  • 在您的 Android 设备上删除您的应用数据并卸载您的应用
  • 使用watchman watch-del-all"清除您的 Watchman 状态
  • 使用npm start -- --reset-cache"启动 React Native 服务器以清除打包器缓存

然后再次构建并运行您的应用.

Then build and run your app again.

这篇关于升级到 0.39 版后未构建 React-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆