Unable to resolve "@react-native/assets-registry/registry" from "assets\image.png"

62 Views Asked by At

I used npm create-expo-stack to create the app. My tech stack includes expo, expo router, and tamagui.

I have this metro.config.js:

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

/** @type {import('expo/metro-config').MetroConfig} */
// eslint-disable-next-line no-undef
const config = getDefaultConfig(__dirname);

module.exports = config;

I tried importing a png file to use in an Image component:

import { View, Image } from 'tamagui';
const logoImg = require('../assets/image.png');

export default function Page() {
  return (
     <View>
        <Image source={logoImg} />
     </View>
    )
}

Problem: when I try to run the app, an error occurs: Unable to resolve "@react-native/assets-registry/registry" from "assets\image.png"

Note: I've tried importing Image from both react-native and tamagui imports.

0

There are 0 best solutions below