expo start --tunnel启动失败:ngrok隧道启动超时问题求助
问题描述
使用expo-cli@6.3.2开发React Native项目已近5个月,此前执行expo start --tunnel从未出现问题,但今日执行该命令时出现异常,同时伴随react-native版本不兼容提示。
执行日志如下:
PS F:\cenas\Cenas> expo start --tunnel This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421 To use the local CLI instead (recommended in SDK 46 and higher), run: › npx expo start Starting project at F:\cenas\Cenas Some dependencies are incompatible with the installed expo package version: - react-native - expected version: 0.70.8 - actual version installed: 0.70.5 Your project may not work correctly until you install the correct versions of the packages. To install the correct versions of these packages, please run: expo doctor --fix-dependencies, or install individual packages by running expo install [package-name ...] Starting Metro Bundler Successfully ran `adb reverse`. Localhost URLs should work on the connected Android device. Using legacy dev server: false Error starting ngrok: Starting tunnels timed out Tunnel URL not found (it might not be ready yet), falling back to LAN URL. Tunnel URL not found (it might not be ready yet), falling back to LAN URL. Started Metro Bundler Tunnel URL not found (it might not be ready yet), falling back to LAN URL. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ █ ▄▄▄▄▄ █▄▄▄ ▀ ██ █ ▄▄▄▄▄ █ █ █ █ ██▄▀ █ ▄█ █ █ █ █ █▄▄▄█ ██▀▄ ▄ ██▀█ █▄▄▄█ █ █▄▄▄▄▄▄▄█ ▀▄█ ▀ ▀ █▄▄▄▄▄▄▄█ █▄ ▀ ▀▄██▄▀█▄██▀ █▄█▀█▀▀▄█ █▄█ ▄ ▄▄▄█▄██▄█ ▄ ▀███▄▀▀ █ █▀ █ ██▄▀ ▄ █▀█▄ █ ▄▀▀█▀ ██ █ ▄▄ ▄ ▄▀▄█▄█▀▄█ ▄▀ ██▄▀ █ █▄██▄██▄█ ▀▄ ▄▄ █ ▄▄▄ ▄▀▄█ █ ▄▄▄▄▄ ██ ▄▀▄ █ █▄█ ███ █ █ █ █ █ ▄ ▄ ██▄ ▄ ▄ █▀▀█ █ █▄▄▄█ █▀▄▀ █▄ ▄█▀▀▄█ █ █▄▄▄▄▄▄▄█▄▄█▄██▄▄▄▄█▄▄███▄█ › Metro waiting on exp://192...... › Scan the QR code above with Expo Go (Android) or the Camera app (iOS) › Press a │ open Android › Press w │ open web › Press r │ reload app › Press m │ toggle menu › Press ? │ show all commands Logs for your project will appear below. Press Ctrl+C to exit. Tunnel URL not found (it might not be ready yet), falling back to LAN URL. Tunnel URL not found (it might not be ready yet), falling back to LAN URL. Tunnel URL not found (it might not be ready yet), falling back to LAN URL.
核心异常
- ngrok启动超时:
Error starting ngrok: Starting tunnels timed out,导致无法生成隧道URL,只能回退到LAN地址 - 依赖版本不匹配:react-native预期版本0.70.8,实际安装0.70.5
解决方案
1. 修复依赖版本问题
执行自动修复命令:
expo doctor --fix-dependencies
或者手动指定版本安装:
expo install react-native@0.70.8
2. 解决ngrok启动超时问题
- 检查网络连通性:确认当前网络可以正常访问外部服务,ngrok需要连接官方服务器建立隧道
- 清理进程后重启:关闭当前Metro Bundler(Ctrl+C),打开任务管理器结束ngrok进程,再重新执行
expo start --tunnel - 使用本地CLI启动:日志推荐使用本地CLI,执行:
npx expo start --tunnel - 更新expo-cli:升级全局expo-cli到最新版本:
npm install -g expo-cli@latest - 手动配置ngrok(可选):如果网络受限,可创建ngrok配置文件指定代理或国内镜像,放在项目根目录下的
ngrok.yml中,再启动项目
内容的提问来源于stack exchange,提问作者Gabriel Silva
相关产品推荐
相关产品推荐

