$ touch A.txt && ls a.txtIt builds on my laptop and fails on the server
Two causes account for most of these, and neither is in your code.
We have not measured how often each cause occurs. Both are verifiable in a minute, which is why this page starts with the command.
What is actually happening
macOS and Windows treat `Header.tsx` and `header.tsx` as the same file. Linux, which is what your server runs, treats them as two. An import with the wrong capitalisation therefore works on your machine and fails on the server, every time, with an error that looks like a missing file.
The second cause is memory. A build is far heavier than serving the result, and a small server without swap will have the build killed by the kernel rather than fail with a readable message — which is why the log often just stops.
Both are properties of the environment. Reading the code will not show either of them.
Confirm it in one command
touch A.txt && ls a.txt
If that finds the file, your filesystem ignores capitalisation and your server almost certainly does not. Everything below follows from that one difference.
Fixing it yourself
- Search your imports for capitalisation that does not match the filename exactly. It is usually one line.
- If the build stops without an error, add swap and try again before anything else.
- Better still, build somewhere with the same operating system as the server — a container is enough.
Where it stops being a small job
When it is neither of those. Then the difference is somewhere in the toolchain versions, and finding it means comparing two environments rather than reading one codebase.
If it is neither capitalisation nor memory, comparing two environments is slow work and hard to do alone. Send the address and the host you are deploying to.
Send us the app