3

I have an expo bare workflow working fine in SDK 49. But when I run expo-doctor and other solutions, I receive many errors about gradle and dependencies.

I've tried to fix it, but many developers with the same problem advised me to create a new project. In my new project, I succeeded with an expo-doctor (no issues).

But now I need help with SVG, PNG, and fonts.

Unable to resolve missing-asset-registry-path from node_modules/@expo-google-fonts/poppins/Poppins_100Thin.ttf

I'll receive a PNG or an SVG if I remove Google fonts.

Below is my 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"
  },

I've tried to update all dependencies, downgrade expo, create a new project, but the project has a great complexity to restart everything. I've tried also to remove the pictures and fonts. But the problem persists. Also tried clearing the cache.

1 Answer 1

11

I changed the configuration in metro.config.js and added the libraries metro-react-native-babel-transformer and babel-plugin-module-resolver.

For me it solved the problem. Good Luck!

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;
Sign up to request clarification or add additional context in comments.

2 Comments

Are you sure it is in metro.config.js instead of babel.config.js?
Yes, it works. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.