Cannot find file? Command failed with exit code 1

site name: wonderful-scone-54e76b
I have been trying to deploy my site with Netlify and constantly get ‘Command failed with exit code 1: CI= npm run build’
I have tried changing my toml file, added ‘CI= npm run build’ in my build settings and still confused as to what the problem is.

I am using the styled-components library and the error always comes up with cannot find file.

1:03:22 PM: > react-weather-app@0.1.0 build
1:03:22 PM: > react-scripts build
1:03:23 PM: Creating an optimized production build…
1:03:25 PM: Failed to compile.
1:03:25 PM:
1:03:25 PM: ./src/Components/Home.js
1:03:25 PM: Cannot find file ‘…/Styles/Styles.js’ in ‘./src/Components’.
1:03:25 PM: ​
1:03:25 PM: ────────────────────────────────────────────────────────────────
1:03:25 PM: “build.command” failed
1:03:25 PM: ────────────────────────────────────────────────────────────────
1:03:25 PM: ​
1:03:25 PM: Error message
1:03:25 PM: Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
1:03:25 PM: ​
1:03:25 PM: Error location
1:03:25 PM: In Build command from Netlify app:
1:03:25 PM: CI= npm run build
1:03:25 PM: ​
1:03:25 PM: Resolved config
1:03:25 PM: build:
1:03:25 PM: command: CI= npm run build
1:03:25 PM: commandOrigin: ui
1:03:25 PM: environment:
1:03:25 PM: - REACT_APP_API_KEY
1:03:25 PM: - REACT_APP_GEO_API_KEY
1:03:25 PM: publish: /opt/build/repo/build
1:03:25 PM: publishOrigin: ui
1:03:25 PM: functionsDirectory: /opt/build/repo/functions
1:03:25 PM: Caching artifacts
1:03:25 PM: Started saving node modules
1:03:25 PM: Finished saving node modules
1:03:25 PM: Started saving build plugins
1:03:25 PM: Finished saving build plugins
1:03:25 PM: Started saving pip cache
1:03:25 PM: Finished saving pip cache
1:03:25 PM: Started saving emacs cask dependencies
1:03:25 PM: Finished saving emacs cask dependencies
1:03:25 PM: Started saving maven dependencies
1:03:25 PM: Finished saving maven dependencies
1:03:25 PM: Started saving boot dependencies
1:03:25 PM: Finished saving boot dependencies
1:03:25 PM: Started saving rust rustup cache
1:03:25 PM: Finished saving rust rustup cache
1:03:25 PM: Started saving go dependencies
1:03:25 PM: Finished saving go dependencies
1:03:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:03:26 PM: Creating deploy upload records
1:03:26 PM: Failing build: Failed to build site
1:03:26 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
1:03:26 PM: Finished processing build request in 1m6.762913321s
Screenshot 2022-08-10 at 13.08.24

I found out why this error was happening. When I created my ‘Styles.js’ file I created it with a lowercase ‘s’, pushed to my GitHub repository, and changed it later down the line but it didn’t update the file name on GitHub.

After changing the file name on GitHub it successfully deployed.