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

React Native 0.69.1版本Fast Refresh失效问题求助

React Native 0.69.1 Fast Refresh 失效的额外排查方案
  • 检查Metro配置文件

    • 确认项目根目录的metro.config.js使用默认配置,避免自定义配置覆盖Fast Refresh相关设置,默认配置示例:
      const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
      const config = {};
      module.exports = mergeConfig(getDefaultConfig(__dirname), config);
      
    • 若有自定义配置,先暂时恢复默认配置测试是否恢复正常。
  • 彻底清理依赖与缓存

    • 删除node_modules文件夹:rm -rf node_modules(Mac/Linux)或rd /s /q node_modules(Windows)
    • 清除包管理器缓存:yarn cache clean 或 npm cache clean --force
    • 重新安装依赖:yarn install 或 npm install
  • 核对依赖版本兼容性

    • 确认package.json中react版本为18.0.0(与RN 0.69.1匹配),版本不匹配则调整后重新安装。
    • 检查@babel/core、babel-preset-react-native等Babel依赖版本是否适配RN 0.69.1,建议使用官方推荐版本。
  • 检查Watchman与系统权限

    • 执行watchman --version确认版本≥4.9.0,版本过低则更新Watchman。
    • 确保项目目录有读写权限,避免Watchman无法监听文件变更。
  • 排查第三方工具冲突

    • 暂时关闭或卸载Flipper、React DevTools等调试工具,部分工具可能干扰Fast Refresh。
    • 移除项目中自定义的Babel/Metro插件,测试是否恢复正常。
  • 检查平台特定配置

    • iOS:在Xcode中,将Build Settings的Debug Information Format设为DWARF with dSYM File,Debug模式下关闭Enable Bitcode。
    • Android:打开android/app/build.gradle,确保debug配置中minifyEnabled和shrinkResources均为false。
  • 重置Metro缓存重启服务

    • 执行npx react-native start --reset-cache,彻底清空Metro缓存后启动服务。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 08:09:18