Failed to compile. Module not found: Error:

Having this error building a react (typescript) app

The error begins at timestamp 5:09:47 PM

5:09:05 PM: Build ready to start
5:09:07 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
5:09:07 PM: build-image tag: v4.5.3
5:09:07 PM: buildbot version: 7eafb394e33f42f945c880ce4ac17c149867813a
5:09:07 PM: Fetching cached dependencies
5:09:07 PM: Failed to fetch cache, continuing with build
5:09:07 PM: Starting to prepare the repo for build
5:09:07 PM: No cached dependencies found. Cloning fresh repo
5:09:07 PM: git clone https://github.com/andrenunes57/dsmovie
5:09:08 PM: Preparing Git Reference refs/heads/master
5:09:08 PM: Parsing package.json dependencies
5:09:09 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'frontend/build' versus 'build' in the Netlify UI
5:09:09 PM: Starting build script
5:09:09 PM: Installing dependencies
5:09:09 PM: Python version set to 2.7
5:09:10 PM: Downloading and installing node v16.14.0...
5:09:10 PM: Downloading https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz...
5:09:10 PM: Computing checksum with sha256sum
5:09:10 PM: Checksums matched!
5:09:13 PM: Now using node v16.14.0 (npm v8.3.1)
5:09:13 PM: Started restoring cached build plugins
5:09:13 PM: Finished restoring cached build plugins
5:09:13 PM: Attempting ruby version 2.7.2, read from environment
5:09:14 PM: Using ruby version 2.7.2
5:09:14 PM: Using PHP version 8.0
5:09:14 PM: Started restoring cached yarn cache
5:09:14 PM: Finished restoring cached yarn cache
5:09:15 PM: No yarn workspaces detected
5:09:15 PM: Started restoring cached node modules
5:09:15 PM: Finished restoring cached node modules
5:09:15 PM: Installing NPM modules using Yarn version 1.22.10
5:09:15 PM: yarn install v1.22.10
5:09:15 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
5:09:15 PM: [1/4] Resolving packages...
5:09:16 PM: [2/4] Fetching packages...
5:09:29 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
5:09:29 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
5:09:29 PM: [3/4] Linking dependencies...
5:09:29 PM: warning " > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
5:09:29 PM: warning " > bootstrap@5.1.3" has unmet peer dependency "@popperjs/core@^2.10.2".
5:09:29 PM: warning "react-scripts > tailwindcss@3.0.23" has unmet peer dependency "autoprefixer@^10.0.2".
5:09:29 PM: warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".
5:09:29 PM: warning "react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".
5:09:36 PM: [4/4] Building fresh packages...
5:09:36 PM: success Saved lockfile.
5:09:36 PM: Done in 21.11s.
5:09:37 PM: NPM modules installed using Yarn
5:09:37 PM: Started restoring cached go cache
5:09:37 PM: Finished restoring cached go cache
5:09:37 PM: go version go1.16.5 linux/amd64
5:09:37 PM: go version go1.16.5 linux/amd64
5:09:37 PM: Installing missing commands
5:09:37 PM: Verify run directory
5:09:38 PM: ​
5:09:38 PM: ────────────────────────────────────────────────────────────────
5:09:38 PM:   Netlify Build                                                 
5:09:38 PM: ────────────────────────────────────────────────────────────────
5:09:38 PM: ​
5:09:38 PM: ❯ Version
5:09:38 PM:   @netlify/build 26.4.0
5:09:38 PM: ​
5:09:38 PM: ❯ Flags
5:09:38 PM:   baseRelDir: true
5:09:38 PM:   buildId: 622fa0e094ff94000992600a
5:09:38 PM:   deployId: 622fa0e094ff94000992600c
5:09:38 PM: ​
5:09:38 PM: ❯ Current directory
5:09:38 PM:   /opt/build/repo/frontend
5:09:38 PM: ​
5:09:38 PM: ❯ Config file
5:09:38 PM:   No config file was defined: using default values.
5:09:38 PM: ​
5:09:38 PM: ❯ Context
5:09:38 PM:   production
5:09:38 PM: ​
5:09:38 PM: ────────────────────────────────────────────────────────────────
5:09:38 PM:   1. Build command from Netlify app                             
5:09:38 PM: ────────────────────────────────────────────────────────────────
5:09:38 PM: ​
5:09:38 PM: $ yarn build
5:09:38 PM: yarn run v1.22.10
5:09:38 PM: $ react-scripts build
5:09:40 PM: Creating an optimized production build...
5:09:47 PM: Failed to compile.
5:09:47 PM: 
5:09:47 PM: Module not found: Error: Can't resolve 'components/Pagination' in '/opt/build/repo/frontend/src/pages/Listing'
5:09:47 PM: error Command failed with exit code 1.
5:09:47 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
5:09:47 PM: ​
5:09:47 PM: ────────────────────────────────────────────────────────────────
5:09:47 PM:   "build.command" failed                                        
5:09:47 PM: ────────────────────────────────────────────────────────────────
5:09:47 PM: ​
5:09:47 PM:   Error message
5:09:47 PM:   Command failed with exit code 1: yarn build
5:09:47 PM: ​
5:09:47 PM:   Error location
5:09:47 PM:   In Build command from Netlify app:
5:09:47 PM:   yarn build
5:09:47 PM: ​
5:09:47 PM:   Resolved config
5:09:47 PM:   build:
5:09:47 PM:     base: /opt/build/repo/frontend
5:09:47 PM:     command: yarn build
5:09:47 PM:     commandOrigin: ui
5:09:47 PM:     publish: /opt/build/repo/frontend/build
5:09:47 PM:     publishOrigin: ui
5:09:48 PM: Caching artifacts
5:09:48 PM: Started saving node modules
5:09:48 PM: Finished saving node modules
5:09:48 PM: Started saving build plugins
5:09:48 PM: Finished saving build plugins
5:09:48 PM: Started saving yarn cache
5:10:03 PM: Finished saving yarn cache
5:10:03 PM: Started saving pip cache
5:10:03 PM: Finished saving pip cache
5:10:03 PM: Started saving emacs cask dependencies
5:10:03 PM: Finished saving emacs cask dependencies
5:10:03 PM: Started saving maven dependencies
5:10:03 PM: Finished saving maven dependencies
5:10:03 PM: Started saving boot dependencies
5:10:03 PM: Finished saving boot dependencies
5:10:03 PM: Started saving rust rustup cache
5:10:04 PM: Finished saving rust rustup cache
5:10:04 PM: Started saving go dependencies
5:10:04 PM: Finished saving go dependencies
5:10:06 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:10:06 PM: Creating deploy upload records
5:10:06 PM: Failing build: Failed to build site
5:10:06 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:10:07 PM: Finished processing build request in 1m0.058813567s

And this is the code with the location of the error, if i understand right.

I dont understand whats is the problem, since in the localhost i got build success with yarn build

Hey @andre.nunes

The issue here is one of case sensitivity. Your local system (Windows, macOS) is not case sensitive, so treats index.tsx as the same file as Index.tsx. Netlify’s build system is Linux, thus case sensitive, so those names are treated as different files.

Specifically, the index file in components/Pagination (when the repository is viewed in GitHub) is Index.tsx and not index.tsx thus the build is failing as it expects the latter filename. I do note the file in the screenshot of your file tree appears show it as lowercase.