Really banging my head against my desk on this one, I spent the last week building out a really awesome new feature for my site just to be hit by build issues on the final hurdle!
I am running into issues when running a build on netifly - I can run and build locally without issues, I am running on a mac so have some indication that this may be a case sensitive issues but I just cant see it
Here is my build Logs
8:46:25 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2) 8:46:21 PM: Netlify Build 8:46:21 PM: ──────────────────────────────────────────────────────────────── 8:46:21 PM: 8:46:21 PM: ❯ Version 8:46:21 PM: @netlify/build 29.15.3 8:46:21 PM: 8:46:21 PM: ❯ Flags 8:46:21 PM: baseRelDir: true 8:46:21 PM: buildId: 64a9bce739b75e00082212cf 8:46:21 PM: deployId: 64a9bce739b75e00082212d1 8:46:21 PM: 8:46:21 PM: ❯ Current directory 8:46:21 PM: /opt/build/repo 8:46:21 PM: 8:46:21 PM: ❯ Config file 8:46:21 PM: No config file was defined: using default values. 8:46:21 PM: 8:46:21 PM: ❯ Context 8:46:21 PM: production 8:46:21 PM: 8:46:21 PM: Build command from Netlify app 8:46:21 PM: ──────────────────────────────────────────────────────────────── 8:46:21 PM: 8:46:21 PM: $ CI= npm run build 8:46:21 PM: > firstname.lastname@example.org build 8:46:21 PM: > react-scripts build 8:46:23 PM: Creating an optimized production build... 8:46:25 PM: Failed to compile. 8:46:25 PM: 8:46:25 PM: Module not found: Error: Can't resolve '../styles/images/chris.webp' in '/opt/build/repo/src/components' 8:46:25 PM: 8:46:25 PM: build.command failed 8:46:25 PM: ──────────────────────────────────────────────────────────────── 8:46:25 PM: 8:46:25 PM: Error message 8:46:25 PM: Command failed with exit code 1: CI= npm run build (https://ntl.fyi/exit-code-1) 8:46:25 PM: 8:46:25 PM: Error location 8:46:25 PM: In Build command from Netlify app: 8:46:25 PM: CI= npm run build 8:46:25 PM: 8:46:25 PM: Resolved config 8:46:25 PM: build: 8:46:25 PM: command: CI= npm run build 8:46:25 PM: commandOrigin: ui 8:46:25 PM: environment: 8:46:25 PM: - CI 8:46:25 PM: publish: /opt/build/repo/build 8:46:25 PM: publishOrigin: ui 8:46:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2 8:46:25 PM: Failing build: Failed to build site 8:46:26 PM: Finished processing build request in 40.317s
Its mentions about not being able to find Chris.webp - have in this build tried to clean up my project directory so I think this is what has caused the issues - I have updated all my imports though and can this building locally without issue
I have pulled the aboutUs page out of the reorganised files to see if this helps but no avail but here are some screenshots of my file tree which include the images that the error mentions
I updated my build command on netifly to include CI = as I read that can help but still struggling!