I lost my desire to live on this error, RN told me that the imported ./Foo file ./Foo not exist when it was there!
Actual main error: not a typo , but actually in another file that ./Foo imported.
Be careful. If you write JSX anywhere (e.g. in ./Bar ):
<Bar>...</Bar>
then you should have:
import * as React from 'react' (or similar)
present in this file ( ./Bar ).
When syntactic sugar (angle brackets) overflows, it naively spits out something like:
React.createComponent(...)
And if React not imported explicitly , this link will be invalid, so the evaluation of this dependent file will subsequently be ignored.
Unfortunately, the result is that ./Foo (as well as ./Bar ) will not be available in your application, and therefore RN talks about useless things like module not found and Indeed, none of these files exist .
Hope this helps.
ps. you can also experience similar misfortune if you have circular dependencies between files! So much fun!
source share