Hi, I’m trying to deploy an app React app created with create-react-app. It keeps failing after it tries to run the build command.
See log below. It seems like it not able to find the .svg file even though it is there. Letter casing is correct and it works locally.
Anybody know why it is Failing even though it’s working locally. I’m on a MAC OS.
Thanks in advance for your help!
log script below:
8:29:36 PM: Verify run directory
8:29:37 PM:
8:29:37 PM: ┌─────────────────────────────┐
8:29:37 PM: │ Netlify Build │
8:29:37 PM: └─────────────────────────────┘
8:29:37 PM:
8:29:37 PM: ❯ Version
8:29:37 PM:
@netlify
/build 3.3.0
8:29:37 PM:
8:29:37 PM: ❯ Flags
8:29:37 PM: deployId: 5f4ef54fe99df01768fd70ff
8:29:37 PM: mode: buildbot
8:29:37 PM:
8:29:37 PM: ❯ Current directory
8:29:37 PM: /opt/build/repo
8:29:37 PM:
8:29:37 PM: ❯ Config file
8:29:37 PM: No config file was defined: using default values.
8:29:37 PM:
8:29:37 PM: ❯ Context
8:29:37 PM: production
8:29:37 PM:
8:29:37 PM: ┌───────────────────────────────────┐
8:29:37 PM: │ 1. Build command from Netlify app │
8:29:37 PM: └───────────────────────────────────┘
8:29:37 PM:
8:29:37 PM: $ npm run build
8:29:37 PM: > [email protected] build /opt/build/repo
8:29:37 PM: > react-scripts build
8:29:39 PM: Creating an optimized production build…
8:29:45 PM: Failed to compile.
8:29:45 PM:
8:29:45 PM: ./src/components/header/header.component.jsx
8:29:45 PM: Cannot find file ‘…/…/assets/crown.svg’ in ‘./src/components/header’.
8:29:45 PM: npm ERR! code ELIFECYCLE
8:29:45 PM: npm ERR! errno 1
8:29:45 PM: npm ERR! [email protected] build:
react-scripts build
8:29:45 PM: npm ERR! Exit status 1
8:29:45 PM: npm ERR!
8:29:45 PM: npm ERR! Failed at the [email protected] build script.
8:29:45 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
8:29:45 PM: npm ERR! A complete log of this run can be found in:
8:29:45 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-09-02T01_29_45_798Z-debug.log
8:29:45 PM:
8:29:45 PM: If the build failed with a warning about “process.env.CI = true”, this is due to “create-react-app” treating warnings as errors when in CI. In order to fix this problem, please either:
8:29:45 PM: - Fix the issues highlighted by the warnings above.
8:29:45 PM: - Or modify the “scripts.build” command in your “package.json” from “react-scripts build” to “CI= react-scripts build”
8:29:45 PM: More information can be found at
Build troubleshooting tips | Netlify Docs
8:29:45 PM:
8:29:45 PM: ┌─────────────────────────────┐
8:29:45 PM: │ “build.command” failed │
8:29:45 PM: └─────────────────────────────┘
8:29:45 PM:
8:29:45 PM: Error message
8:29:45 PM: Command failed with exit code 1: npm run build
8:29:45 PM:
8:29:45 PM: Error location
8:29:45 PM: In Build command from Netlify app:
8:29:45 PM: npm run build
8:29:45 PM:
8:29:45 PM: Resolved config
8:29:45 PM: build:
8:29:45 PM: command: npm run build
8:29:45 PM: commandOrigin: ui
8:29:45 PM: publish: /opt/build/repo/dist
8:29:45 PM:
8:29:45 PM: ./src/components/header/header.component.jsx
8:29:45 PM: Cannot find file ‘…/…/assets/crown.svg’ in ‘./src/components/header’.
8:29:45 PM: npm ERR! code ELIFECYCLE
Howdy,
it’s definitely related to us not being able to find the file
If it’s not case (you are sure? that is the cause of the problem 99.99% of the time…) is it maybe the path?
just in case… (that was a terrible joke)
[Support Guide] Netlify app builds locally but fails on deploy (case sensitivity)
Support Guides
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 sens…
import {App} from ‘./app’;
I’ve tried to add the node and npm version I’m using in a netlify.toml file but it still doesn’t work.
Uploading the build folder works fine
I found the issue. For whatever reason, git was keeping track of
app.js
as
App.js
. Thus, the file uploaded via Github to Netlify was nammed
App.js
.
To solve this I did:
git rm -r --cached src/App.js
,
git add src/app.js
and it worked.
[Support Guide] Netlify app builds locally but fails on deploy (case sensitivity)
Support Guides
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 sens…