You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Reactotron调试器无法连接:提示“new Proxy target must be an Object”

解决Reactotron连接报错new Proxy target must be an Object的问题

问题现象

  • 项目运行正常,但无法连接Reactotron调试器,报错提示:new Proxy target must be an Object
  • 已尝试修改Reactotron和ADB端口,问题仍未解决

Error

排查与解决步骤

1. 检查Reactotron配置合法性

这个报错核心是Proxy的目标不是有效对象,重点排查项目中的ReactotronConfig.js配置文件:

  • 确认configure()、useReactNative()等方法传入的参数是完整对象,没有传入null、undefined或原始值
  • 若有自定义Proxy扩展逻辑,确保target参数为Object类型

2. 修复版本兼容性问题

Reactotron与React Native版本不匹配常引发此类异常:

  • 查看当前reactotron-react-native版本:npm list reactotron-react-native
  • 若使用React Native 0.70+,升级到最新版:
    npm install reactotron-react-native@latest --save-dev
    

3. 清除缓存并重启服务

缓存问题可能导致配置不生效:

  • 重置React Native缓存:
    npx react-native start --reset-cache
    
  • 重启ADB服务:
    adb kill-server
    adb start-server
    
  • 关闭Reactotron客户端后重新打开,再重启项目

4. 确认局域网连接配置

  • 保证电脑与设备/模拟器处于同一局域网
  • 配置Reactotron时使用电脑的局域网IP而非localhost:
    Reactotron.configure({ host: "192.168.x.x" }) // 替换为你的实际局域网IP
      .useReactNative()
      .connect();
    

内容的提问来源于stack exchange,提问作者CodeWith Mufaddal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 09:17:43