博览会错误获取地址信息ENOTFOUND ASSURCES EXPO

人气:541 发布:2022-10-16 标签: reactjs react-native expo

问题描述

我的应用程序从EXPO中被弹出,所以我每次发布版本时都必须进行EXPO发布 该方法完美运行了50多次,但在发布EXPO后,当我尝试用Xcode进行归档或在Android IAM中生成发布版本时,突然出现以下错误

在Xcode中:

Showing All Messages
https://assets/3c851d60ad5ef3f2fe43ebd263490d78
https://assets/1a0e3525dd5df87e77057204129a5e6e
https://assets/2379ae894c2c9f63b852a9f3676c2763
https://assets/5cdf883b18a5651a29a4d1ef276d2457
https://assets/74d124a3caeac2bea111f3ca2f2dd34a
[20:37:23] Error: getaddrinfo ENOTFOUND assets

[20:37:23] Before making a release build, make sure you have run 'expo publish' at least once. Learn more. (​https://expo.fyi/release-builds-with-expo-updates​)

在Android中:

> Task :app:bundleReleaseExpoUpdatesAssets
https://assets/3c851d60ad5ef3f2fe43ebd263490d78
https://assets/1a0e3525dd5df87e77057204129a5e6e
https://assets/2379ae894c2c9f63b852a9f3676c2763
https://assets/5cdf883b18a5651a29a4d1ef276d2457
https://assets/74d124a3caeac2bea111f3ca2f2dd34a
[21:22:20] Error: getaddrinfo ENOTFOUND assets
[21:22:20] Before making a release build, make sure you have run 'expo publish' at least once. Learn more. 

即使我的EXPO发布已经完成,如果我尝试构建存档或APK,我也会收到错误

我试过Clear Watchman, 卸下节点模块、重新安装Pod、清除缓存等 无济于事

推荐答案

Did try this solution using the instructions from the pdf但对我不起作用。我花了几天时间寻找解决方案,但都没有奏效,所以我深入研究了这个问题。

我的项目正在使用世博会SDK36。

对我起作用的是以下解决方案。

要求

安装expo-cli:npm install expo-cli --save-dev

每当我们使用Xcode存档或Android GradleassembleRelease命令进行构建时,它们都会执行expo bundle-assets命令。我们将在以下步骤中替换EXPO并使用本地expo-cli

特定于iOS的解决方案

在我们的项目中安装expo-cli后,我们需要替换生成命令。 转到Xcode;项目名称&>目标&>选择您的项目&>构建阶段 在构建阶段&>下,转到博览会捆绑包资产或类似内容 替换:expo bundle-assets --platform ios --dest "$dest"npx expo-cli bundle-assets --platform ios --dest "$dest" 运行npx expo-cli publish --clear 清理项目并开始存档/生成!

Android特定解决方案(适用于MacOS/Linux)

在项目根文件夹上,创建名为run-exp.sh的文件。 在run-exp.sh内添加以下行:
#!/usr/bin/env bash

value=$(cat ~/.expo/PATH)
PATH="$PATH:$value" npx expo-cli "$@"
在项目根文件夹下,转到android/app/expo.gradle 替换此行:
commandLine("./node_modules/expokit/detach-scripts/run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)

commandLine("./run-exp.sh", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
运行npx expo-cli publish --clear 在Android Studio上,清理项目并构建应用程序

Android特定解决方案(适用于Windows)

在项目根文件夹上,创建名为run-exp.bat的文件。 在run-exp.bat内添加以下行:
SET /P STOREDPATH=<"%USERPROFILE%.expoPATH"
SET PATH=""%PATH%;%STOREDPATH%""
npx expo-cli %*
在项目根文件夹下,转到android/app/expo.gradle 替换此行:
commandLine("cmd", "/c", ".\node_modules\expokit\detach-scripts\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)

commandLine("cmd", "/c", ".\run-exp.bat", "bundle-assets", expoRoot, "--platform", "android", "--dest", assetsDir)
运行npx expo-cli publish --clear 在Android Studio上,清理项目并构建应用程序

485