stinodes
stinodes

Reputation: 1269

NPM not recognising my module (requiring unknown module)

I'm working an a React-Native app, and am writing my components into different files, exporting them and importing them wherever they're needed. This is working fine in all instances instead of one, where npm keeps throwing a 'Requiring unknown module'-error.

My structure is as follows:

In NavBar.js, I am exporting my component like so:

class NavBar extends Component {  
    ...
}
export default NavBar;

And importing it in Navigator.js like so:

import NavBar from './NavBar';

The complete message I get on my device when trying to run the app is as follows:
Requiring unknown module "./NavBar". If you are sure the module is there, try restarting the packager or running "npm install".

I have tried both those things (multiple times) to no avail.
I must be looking over something stupid, but can't seem to find it. Can anyone else see what I'm doing wrong here?

Upvotes: 0

Views: 470

Answers (1)

stinodes
stinodes

Reputation: 1269

What I did to get it fixed:
I refactored the file to something else, and back to NavBar.js.

This was probably just caused by me misspelling something in the first place.
So don't forget to check, double check and double check again.

Upvotes: 1

Related Questions