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

React Native 0.73.6报错:无法解析missing-asset-registry-path模块

解决React Native中missing-asset-registry-path模块解析错误

针对你使用React Native 0.73.6时出现的missing-asset-registry-path模块无法解析错误,且怀疑与ESLint配置相关的情况,可按以下步骤排查解决:

  • 排除ESLint对静态资源的解析
    ESLint若误将图片这类二进制文件当作JS模块解析,会触发该错误。修改你的ESLint配置文件(如.eslintrc.js),在ignorePatterns中添加静态资源后缀,避免ESLint处理它们:

    module.exports = {
      // 其他已有配置
      ignorePatterns: [
        '*.png',
        '*.jpg',
        '*.jpeg',
        '*.gif',
        'node_modules/'
      ],
    };
    

    如果你使用了eslint-plugin-import插件,需确保其配置未将图片文件纳入解析范围。

  • 清除缓存并重装依赖
    缓存或依赖损坏也可能导致资源解析异常,执行以下命令:

    1. 重置React Native缓存:npx react-native start --reset-cache
    2. 删除依赖目录与锁文件:rm -rf node_modules package-lock.json yarn.lock
    3. 重新安装依赖:npm install(或yarn install)
    4. 重新构建项目:npx react-native run-ios(iOS环境)或npx react-native run-android(Android环境)
  • 验证导航库版本兼容性
    检查@react-navigation/elements版本是否适配React Native 0.73.6,若版本过低,执行升级命令:npm install @react-navigation/elements@latest

  • 确认Metro配置正确性
    若自定义了metro.config.js,需确保未错误排除图片资源。保持Metro默认配置即可正常处理静态资源,示例配置:

    const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
    
    const config = {};
    
    module.exports = mergeConfig(getDefaultConfig(__dirname), config);
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 11:23:14