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

iOS设备运行Expo项目遇SHA-1未计算错误,求解决方法

解决Expo iOS项目中Metro的SHA-1未计算错误

针对你遇到的ReferenceError: SHA-1 for file /Users/birfatura/node_modules/@react-native/polyfills/console.js is not computed错误,按以下步骤逐一排查解决:

处理符号链接问题

  • 检查项目中是否存在符号链接(比如本地依赖的软链接),如果有,配置watchman追踪符号链接:
    1. 在项目根目录创建.watchmanconfig文件,写入以下内容:
      {"enable_symlinks": true}
      
    2. 执行命令清除watchman缓存并重启服务:
      watchman watch-del-all
      npx expo start --clear
      

检查metro.config.js的blockList配置

  • 打开项目根目录的metro.config.js,找到blockList配置项,确认其中没有排除@react-native/polyfills/console.js或其父路径的规则。比如如果有类似/node_modules/@react-native/polyfills/的条目,直接删除该规则。
  • 修改完成后,执行npx expo start --clear重启Metro服务。

额外排查步骤

如果以上方法无效,尝试彻底清理依赖和缓存:

  • 删除node_modules并重新安装依赖:
    rm -rf node_modules && npm install
    
  • 清除Expo和Metro的所有缓存:
    npx expo r -c
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 06:30:55