[Support Guide] Netlify app builds locally but fails on deploy (case sensitivity)

Last Reviewed By Netlify Support Staff: December 2022

Are you struggling to understand why your project runs locally but errors out with missing files or logs that point toward issues with case when you try and build on Netlify? You are not alone. Often, case (as in: UPPERCASE or lowercase letters in filenames or paths) can cause problems. Here is a guide to understanding how case sensitivity issues present themselves, why they arise, and how you can fix them!

1. Errors you might see

Case sensitivity issues can be frustrating to debug because sometimes you’ll receive error messages letting you know that files could not be found when they are clearly present during the build process. See this post for a great example:

Sometimes you might just have a failing build without any useful error messaging as it depends on which file has the issue.

2. Why does this happen?

If you work on Windows or OSX (mac), you are working on a case-insensitive system. The file system used in Netlify builds is case sensitive, while your local environment is not. Unfortunately, the error messages that result may not clearly indicate this!

Meaning: if your code includes a file or reference to a file like jQuery/jquery.js — the Netlify build may fail due to the mixed case filename. This issue can be present with ANY file that is an important part of your project, including, but not limited to:

  • entry-point application files like App.js or Main.js (not the same as app.js or main.js)
  • partials, modules, imports, templates
  • dependencies, packages
  • font files
  • image, css and json files
  • netlify.toml, _redirects, package.json, Gemfile or any other config or settings files
  • …anything!

This issue also happens regardless of where the case sensitivity occurs. To be really clear, during the build step:

somefile.js != someFile.js != SomeFile.js != SOMEFILE.js != sOmEfIlE.js

We strongly recommend that you pay very close attention to how you use case from the very beginning in your project, and standardize how you use case throughout so you don’t have problems during the build step on Netlify.

3. How can I fix these problems?

If you haven’t committed your files to version control (we are assuming you are using Git) then it is sufficient to simply rename the file(s) in question and the problem should fix itself.

That said, most people realize they are having a case issue when they try and build on Netlify, as the problem doesn’t occur locally. This almost always means that the file(s) have been committed to Git and pushed to a provider such as GitHub. Simply renaming the file and re-committing and pushing it does not generally work because Git’s default setting is to ignore case, and so those changes aren’t always registered. :confused:

This thread on Stack Overflow has lots of useful approaches on how to deal with this. We have also found that the following steps will do the trick:

  1. deleting the file
  2. committing and pushing to GitHub
  3. re-creating the file
  4. adding, committing, pushing to GitHub

As soon as the case issue is resolved, you should see any problems related to this vanish and enjoy smooth, problem free builds on our platform :tada:

If you are still having issues after fixing the case related issues, this Support Guide contains many other troubleshooting steps for common concerns! Good luck & please comment below if you have additional thoughts!

Build fails on Netlify, works locally
Gatsby site deploy failed
Module not found: Error: Can't resolve
Netlify build failed with webpack error - css-syntax-error (unknown word)
[Support Guide] I’ve deployed my site but I still see "Page not found”
Typescript build error for missing modules or types declaration
JS bundle failure
Eleventy starter Ghost
Gatsby Wordpress CMS deploying build issue
Deployment error advice
Any reason why gulp build on netlify deploy doesn't inject css/js in html files?
TypeError: Cannot read property of undefined
Yarn build failed: unable to resolve component path
ENOENT: no such file or directory, open '/opt/build/repo/assets/favicon.png'
Deployment fails due to filename cases
Error during build Angular App
Not able to see changes to the deployed site
GraphQL...unix error: No such file or directory
Build script returned non-zero exit code: 1
Trying to request my privacy policy page generates an error
Image gets 404 in preview build
Nuxt production build differs from staging
URL is not working
React Deploy Failed @ npm run build error code ELIFECYCLE errno 1 Cannot find file
Build Failure: The path passed to gatsby-source-filesystem does not exist on your file system
Page not found for route "/login"
Local build was successful but build at Netlify is not working
Unable to build, build failing
HELP Works locally, worked on Netlify but suddenly stoppen
Webpack react js in netlify
I have manually deployed this react site but whenever I try to deploy it with github it says it can't resolve a module
Nuxt Generate Breaking Build
Some UX/UI features of my live site renders differently than on my local environment
Deploy fails during stage ‘building site’
Site with react-bootstrap fails during deploy
Project builds locally but get "WebpackError: TypeError: Cannot read property 'childImageSharp' of null" with Netlify
Menu in config for Hugo is not working
Cannot find file problem
Gridsome <g-image> images are blurry after build and deploy
Site coded in React works in localhost but strips CSS in Netlify prod
Deployment Failed - Error Generating JavaScript bundles failed
How to fix build failures with `create-react-app` in production
Vue app deploy error
Hugo Partial Not Rendering Once Deployed to Netlify
Cannot find file...' error when building, case sensitive issue
Gatsby Site Can't Resolve
Site looking all wrong
Deploy failed Hugo
Deploy Failed confusion
Status 404 () when submit form using react.js stateful component
App running locally but once deployed to netlify I got this message:
"This dependency was not found:" error when deploying simple Vue site
[React ssr via functions]Unexpected token error
Deploying seems stuck forever on build
Gatsby builds local, but fails on Netlify
Hugo blog deployment failed
Deploy fails with "Cannot find module 'firebase-admin' " even though module is in the function's package.json
Publication names shown in lowercase
Page Header Not Loading...Netlify issue?
Extra component gets rendered but after refresh it doesn't show
Gatsby Build failed
Gatsby fails on netlify, build locally
Netlify can't find react-bootstrap/Navbar
React Deploy Failed @ npm run build error code ELIFECYCLE errno 1 Cannot find file
Gatsby and Sass Config - Fails during build
Deploys keep failing?
Local NPM dependency in package.json not installing
React Component is not rendering after deploying to Netlify
Style changes after deploying react app
Module not found: Error: Can't resolve in view
Error Insufficient number of arguments or no entry found
Deployment fails – can't find files in folder that's added to git
Static files are not copied (or linked) after deploy
Signup landing page. - Gridsome starter bootstrap
Netlify deployment crashes because app.tsx fails to load all my pages
Netlify Build Fails - SCSS and Vue build fails
Missing files when deployed to Netlify
Build failed because of webpack errors (Next.js + AWS Amplify)
Typescript Build Error with Next.js
Sass Error: Can't find stylesheet to import
Module not found: Error: Can't resolve './Scenes/PhaserGame.tsx' in '/opt/build/repo/src'
Problem when deploy node js project from GitHub repo CI= npm run build
Conflicting lock packages? build/assets? error code 1 and 2
Nuxt & Vuetify Failed Build - can't resolve webp image
Netlyfy deploy path is not resolved for SVG files - Gatsby
Next.js deploy fails on webpack build
Can't deploy next.js site
Building script returned non zero exit code:2
Sveltekit build works, fails to deploy on Netlify
Gatsby run build - error at createPages that is working ok on gatsby develop
Gatsby run build - error at createPages that is working ok on gatsby develop
[Support Guide] Compiled Build and Deploy Resources -- start here!
It works well my localhost but cant deploy in netlify
Failed to compile. Module not found: Error:
Im reciving this error every time
Deployment error with build
Cant find file to read, pre-render. Builds locally but fails on netlify
Sveltekit build failing on Netlify with "Could not resolve...", whilst succeeding locally
Jekyll site won't build: Error: No such file or directory @ rb_sysopen
Vue.js Site Deployment Error - node package problem?
Have problem with deploying
Error when importing a custom font
Build Failed - Netlify looks for "Layout" instead of "layout" - Gatsby App
Cannot find module <filename> or its corresponding type declarations
Site deploy error - Can't resolve markdown file
Command failed with exit code 1: CI= npm run build (https://ntl.fyi/exit-code-1)
Build Failed with “non-zero exit code: 2” error
Can't deploy next.js site
Can't resolve 'styled-system' in '/opt/build/repo/src/pages'
Absolute Paths not recognized in Build Deployment --> Site crashes
React Component is not rendering after deploying to Netlify
How to fix build failures with `create-react-app` in production
Svelte 'Sapper' build not recognizing JS optional chaining operators in Netlify
Deploy errors attempting to deploy Statamic SSG site
Exit Code 1 / Exit Code 2
Netlify Build issue when Gatsby MDX using relative import
What is the difference between ntl dev --live and what's deployed through Netlify?
Text not visible in published website
Data in useEffect react app not rendering
Mygitnews / national-news-repository
Can't deploy website with parcel
Building production JavaScript and CSS bundles failed
Could not resolve '../store/Auth' from middleware/auth.ts
Gatsby site fails to build on Netlify, but works locally

2 posts were merged into an existing topic: Hugo Partial Not Rendering Once Deployed to Netlify

If you’re using TypeScript, would recommend setting this in your tsconfig.json:

“forceConsistentCasingInFileNames”: true,


Hey @perry,
Thank you for this, as it clarifies some doubts. I seem to have stumbled upon this problem for the first time.
What I don’t understand is, why does it only seem to happen on certain occasions? For example, when deploying a specific app, and not another one, even though they share the same naming conventions?

1 Like

hi antonio,

all apps should have the same restrictions - i.e our systems are always case sensitive, and mac/windows operating systems will always be insensitive. therefore, the best option is to choose one naming convention and stick with it. making everything lowercase seems to work for most people!

Hi, so there are many solutions to this case sensitivity problem with how github handles it.

In my case I had changed the filename casing convention from uppercase to lowercase. I do believe that git is able to track the change but however this command
git config core.ignorecase false dictates how git operates behind the scenes

In my case I ran the command and git suddenly had lots of files to track labelled untracked.

I then hit git add. , then git commit and ran my build on netlify one more time.

Then all errros now displayed could be traced e.g
Module not found: Can't resolve './Components/ProductRightSide' in '/opt/build/repo/components/products and fixed such that git was able to track and implement the changes successfully.

Its quite a work around and a finger nail away from frustration but trust me this will surely work.

PS : after fixing your issue you may want to run the command
git config core.ignorecase true to restore how git works with case sensitivity.

Also note git config core.ignorecase false has issues with other file name extensions so you may want to watch out , do it if you know what you’re doing and sure of it.

Here’s the stack overflow thread I got my solution from


Thanks a lot! Spent 2 days trying to understand what’s the problem was. I appreciate your solution.

1 Like

Glad this was helpful for you, @IamSoPrada. Happy building :clap:

I spent a lot of time trying to fix it but it still doesn’t work Example: “https://example.com/home/ExaMpLe.html” but when i access the link, the website link automatically lowercase like :“https://example.com/home/exanple.html” please someone help me, I’m a newbie and please explain in short and easy to understand.

The above post is not related to your query. We’re talking about case sensitivity during builds. You’re asking about case sensitivity during site serving. Netlify normalises all URLs to lowercase, so what you’re looking for is not possible.

1 Like

I can confirm that this worked for me, as I was a rebel and changed the entire naming convention of my vue related project. I was nearly in tears trying to get things to work in production. Thank you very much for this. May God bless you.

1 Like

Hi @kennyfully88 :wave:t6: , Welcome to the forums! Thanks for coming back and letting us know what worked for you. We appreciate the feedback.

This worked for me. Thanks a bunch!