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

全新React Native(Expo)项目运行报错:无法解析TabBarIcon模块

Expo 新项目模块解析错误:无法找到 @/components/navigation/TabBarIcon

今早碰到这个问题,一开始以为是自己代码写错了,结果全新创建的 React Native(Expo)项目也报同样的错误。

错误日志

Server Error
Unable to resolve module @/components/navigation/TabBarIcon from C:\Users\quinc\projects\Re\Re\app\(tabs)\_layout.tsx: @/components/navigation/TabBarIcon could not be found within the project or in these directories:
  node_modules
  2 | import React from 'react';
  3 | import { Platform } from 'rea... See More
Call Stack
<unknown>
app/(tabs)/_layout.tsx
Collapse 1 frame
Web Bundling failed 2909ms C:\Users\quinc\projects\Re\Re\node_modules\expo-router\entry.js (878 modules)
λ Bundling failed 2919ms C:\Users\quinc\projects\Re\Re\node_modules\expo-router\node\render.js (920 modules)

Metro error: Unable to resolve module @/components/navigation/TabBarIcon from C:\Users\quinc\projects\Re\Re\app\(tabs)\_layout.tsx: @/components/navigation/TabBarIcon could not be found within the project or in these directories:
  node_modules
  2 | import React from 'react';
  3 | import { Platform } from 'react-native';
> 4 |
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5 | import { HapticTab } from '@/components/HapticTab';
  6 | import { IconSymbol } from '@/components/ui/IconSymbol';
  7 | import TabBarBackground from '@/components/ui/TabBarBackground';


Call Stack
  <unknown> (app/(tabs)/_layout.tsx)

补充信息

  • 已创建全新裸安装项目用于复现该问题
  • Expo 环境信息:
expo-env-info 1.2.1 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    SDKs:
      Android SDK:
        API Levels: 31, 34, 35
        Build Tools: 30.0.2, 34.0.0, 35.0.0
        System Images: android-35 | Google Play Intel x86_64 Atom
    IDEs:
      Android Studio: AI-242.23339.11.2421.12550806
    npmPackages:
      expo: ~52.0.7 => 52.0.7
      expo-router: ~4.0.6 => 4.0.6
      react: 18.3.1 => 18.3.1
      react-dom: 18.3.1 => 18.3.1
      react-native: 0.76.2 => 0.76.2
      react-native-web: ~0.19.13 => 0.19.13
    Expo Workflow: managed

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 08:16:02