1

The full error message is: None of these files exist:

  • ..\src\components\Main.jsx(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
  • ..\src\components\Main.jsx\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)

I have the file Main.jsx in ./src/components/Main.jsx but it doesnt detect it

VS Code explorer

The react native version is 0.71.3 The react version is 18.2.0 The node version is 18.14.2

I have tried using backwards slash but htat didnt solve the problem.

App.js

import React from 'react'
import Main from './src/components/Main.jsx'

export default function App() {
  return <Main />
}

Main.jsx

import React from 'react'
import { Text, View } from 'react-native'

const Main = () =>{
    return (
        <View>
            <Text>Hola Mundo</Text>
        </View>
    )
}

export default Main

1 Answers1

0

If you are a Mac user try to check file name case sensitivity e.g if your file name is main.js and you are importing Main.js. Then it fails to detect files in mac machines sometime. Moreover try to check if pathname is correct and re-run the server after cleaning npm cache.

For cahce clean you can use command:

> npm cache clean –force
Mudasser
  • 1
  • 2