Skip to content

Instantly share code, notes, and snippets.

@njleonzhang
Last active August 29, 2022 01:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njleonzhang/68c6491132d1fc383edf982c26cd8446 to your computer and use it in GitHub Desktop.
Save njleonzhang/68c6491132d1fc383edf982c26cd8446 to your computer and use it in GitHub Desktop.
react native 坑

用xcode编译RN项目的时候, 出现“RCTBundleURLProvider.h” file not found - AppDelegate.m

解决:

xcode Product->Scheme->Manage Schemes click '+' at the Target to select "React" and set the React is shared.

stackoverflow上 mark 的答案。

编译完成后,手机App上出现: Connection to http://localhost:8081/debugger-proxy?role=client xxxxxx

在电脑上启动 Packer server, npm start

Runtime is not ready for debugging. Make sure Packer server is running

RN app 连上 bundle server后,会自动打开一个 debug-ui 的页面,这个页面可用于断点调试。如果刷新这个页面则会出现这个问题。 解决方案 reload 几次. (有时候1次不能成功, stupid) RN的debug原理:1, 2

module react-navigation does not exist in the Haste module map

  • watchman watch-del-all
  • rm -rf node_modules && cnpm i
  • npm start -- --reset-cache

无法load bundle

Could not get BatchedBridge, make sure your bundle is packaged correctly,
failed to call function, _fbBatchedBridge is undefined

重装依赖,重置ios android项目后解决。

用 yarn 安装依赖,否则会有各种莫名其妙的问题。

rm -rf node_modules
rm -rf ios
rm -rf android

yarn install
react-native upgrade

remote debug android 的时候,卡住了。调试发现 AsyncStorage.getItem 没有填充

这是RN的bug到现在都没有解决。。。。。。。。。惊呆了。 facebook/react-native#12830

Unable to resolve module /../react-transform-hmr/lib/index.js

facebook/react-native#21530 (comment)

Build input file cannot be found: '....../node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'

$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
$ cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../

hotreload 失效

清空watchman 缓存,重装依赖得到解决。

watchman watch-del-all
rm -rf node_modules 
yarn install
npm start -- --reset-cache

高版本android 白屏

打开应用的 悬浮窗 权限

react-native/third-party/glog-0.3.5/src/base/mutex.h:105:10: 'config.h' file not found

// 删除下面这个目录,可以临时的解决问题
rm -rf node_modules/react-native/third-party

facebook/react-native#14382

ios 找不到服务器

细查发现 ip.txt 没有生成。再查发现有一个 bug 虽然修复了,但是没有release。

facebook/react-native#20553

SKIP_BUNDLING 选项本来是用于防止开发包打包的,但是他的副作用是 ip.txt 不生成了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment