React Native - Unable to Resolve Module

I am getting the error:

Unable to resolve module ../Style/Colours from /Users/vagrant/git/src/Root/Login.js: could not resolve /Users/vagrant/git/src/Style/Colours as a folder: it did not contain a package, nor an index file

Which is strange because this is the last import statement in Login.js, meaning the others of similar nature are passing…

src/Style/Colours is an existing JavaScript file, and what’s more strange is that the code builds and runs locally…

Found the issue that while change the file locally to Colours.js, git was still seeing it as colours.js…can close issue

The dreaded case sensitivity git issue… Good catch @brenwarwcdg btw! :wink:

So, indeed, git treats file name changes kind of case insensitive, in case there’s no other change in the file’s name other than an upper<->lover case letter change.

The best way to handle this is:

  1. First delete the file (well, move it out from the repo temporarily)
  2. Commit the change (should be a file delete in the git history/commit)
  3. Then restore the file (move back the file) and change the name
  4. Commit

This way git will add the file again, this time with the right file name.

1 Like

That fixed it, thanks :slight_smile:

1 Like