无法解决“missing-asset-registry-path”expo React Native

问题描述 投票:0回答:1

我有一个

expo bare workflow
SDK 49
中运行良好。但是当我运行
expo-doctor
和其他解决方案时,我收到许多关于
gradle
和依赖项的错误。

我尝试修复它,但许多遇到同样问题的开发人员建议我创建一个新项目。在我的新项目中,我成功了

expo-doctor
(没有问题)。

但现在我需要 SVG、PNG 和字体方面的帮助。

无法解析缺失资产注册表路径 node_modules/@expo-google-fonts/poppins/Poppins_100Thin.ttf

如果删除 Google 字体,我将收到 PNG 或 SVG。

下面是我的

package.json

"dependencies": {
    "@babel/preset-env": "^7.23.9",
    "@expo-google-fonts/poppins": "^0.2.3",
    "@firebase/firestore": "^4.4.2",
    "@gorhom/bottom-sheet": "^4.6.1",
    "@react-native-firebase/app": "^19.0.0",
    "@react-native-firebase/auth": "^19.0.0",
    "@react-native/babel-preset": "^0.73.21",
    "@react-navigation/native": "^6.1.12",
    "@react-navigation/stack": "^6.3.23",
    "@reduxjs/toolkit": "^2.2.1",
    "@types/react": "~18.2.45",
    "@types/styled-components": "^5.1.34",
    "dotenv": "^16.4.5",
    "expo": "~50.0.7",
    "expo-asset": "~9.0.2",
    "expo-checkbox": "~2.7.0",
    "expo-clipboard": "~5.0.1",
    "expo-constants": "~15.4.5",
    "expo-dev-client": "^3.3.8",
    "expo-image-manipulator": "~11.8.0",
    "expo-image-picker": "~14.7.1",
    "expo-splash-screen": "~0.26.4",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "^2.9.3",
    "expo-updates": "~0.24.11",
    "firebase": "^10.8.0",
    "lodash": "^4.17.21",
    "phosphor-react-native": "^2.0.0",
    "react": "18.2.0",
    "react-native": "0.73.4",
    "react-native-bouncy-checkbox": "^3.0.7",
    "react-native-dotenv": "^3.4.10",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-element-dropdown": "^2.10.1",
    "react-native-gesture-handler": "2.14.0",
    "react-native-get-random-values": "1.8.0",
    "react-native-paper": "^5.12.3",
    "react-native-reanimated": "3.6.2",
    "react-native-safe-area-context": "4.8.2",
    "react-native-svg": "^14.1.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-native-vector-icons": "^10.0.3",
    "react-redux": "^9.1.0",
    "styled-components": "^6.1.8",
    "typescript": "^5.3.0",
    "uuid": "^9.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/uuid": "^9.0.7",
    "typescript": "^5.1.3"
  },

我尝试过更新所有依赖项、降级expo、创建一个新项目,但该项目非常复杂,需要重新启动所有内容。我也尝试过删除图片和字体。但问题仍然存在。也尝试过清除缓存。

react-native expo react-native-firebase
1个回答
0
投票

我正在metro.config.js上更改配置,添加了库metro-react-native-babel-transformer、babel-plugin-module-resolver

metro.config.js 代码。对我来说它解决了问题。祝你好运!

const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);

const { transformer, resolver } = config;

config.transformer = {
...transformer,
babelTransformerPath: require.resolve("react-native-svg-transformer"),
}

config.resolver = {
    ...resolver,
    assetExts: resolver.assetExts.filter((ext) => ext !== "svg"),
    sourceExts: [...resolver.sourceExts, "svg"],
  };

module.exports = config;
© www.soinside.com 2019 - 2024. All rights reserved.