All Questions

Coding

Anyone used Gatsby with Netlify or Vercel ?

I’m getting this error during build in both, it seems it is not able to import the components

7:37:54 PM: error Generating JavaScript bundles failed
7:37:54 PM: Can't resolve '../components/Layout' in '/opt/build/repo/src/pages'
7:37:54 PM: If you're trying to use a package make sure that '../components/Layout' is installed. If you're trying to use a local file make sure that the path is correct.```

author Suvojit Manna

Reply
7 Answers

Cristian Sandu is the king of Gatsby

writen by Tiago Ferreira

Found the culprit.

Somehow uploading to github was changing the cases of the files. Example Layout.js -> layout.js

Running git config core.ignorecase false fixed it.

writen by Suvojit Manna

You’re using Mac? Might be related to the system set to ignore case in the first place.

writen by Benedikt

Yes Benedikt this is on Mac. Will check it out !

writen by Suvojit Manna

never seen this case transformation before

writen by Luca Restagno (ikoichi on Twitter)

This often happens if you somehow change the casing on files that are already in a git repo. Is it possible the filename cases were changed after they were already in the repo?

Sounds like you’re already aware of this, but for anyone following along who is curious: Git is case-sensitive (eg, you can have file.txt and File.txt in a git repo).

The Mac’s file system, by default, is not case-sensitive. So on a Mac I can rename file.txt to File.txt and the FS doesn’t care, those are the same thing.

That means Git never gets the message that anything changed, so the repo and local are no longer in sync. If you push that repo to another computer, it will appear with the old filename casing.

I’ve usually used git mv to fix individual cases like this. https://sebastiandedeyne.com/how-to-do-a-case-sensitive-file-rename-in-git-on-macos/

writen by Matt Morris

Matt I took the screenshot after the git push, so the local files were still capitilized and the github files were lowercase. It felt like a weird error to happen 🤔

writen by Suvojit Manna

Do you want to ask a question?


Related Questions