Module not found: Error: Can't resolve './Components/Toolbar'

Hello, I am making a React project using Node.js. I initially already deployed the site by dragging and dropping the build folder as I needed the site up and running quickly. Now, I am trying to deploy it from my GitHub branch and I keep getting the message "Module not found: Error: Can’t resolve ‘./Components/Toolbar’ in ‘/opt/build/repo/diagram-app/src’ ". I initially assumed I misspelt something in the import statement in App.js but that doesn’t seem to be the case. I saw some similar posts and have tried the solutions linked there. I have also tried deleting the component, committing and pushing to GitHub, then recreating and pushing again and still no luck. I am not having any issues building locally. I have also tried deleting node-modules and package-lock.json and running npm install. Any help would be appreciated.

The URL is: https://compilationdiagram.netlify.app/

Here are the logs:
7:25:38 PM: build-image version: 782b5df339f214fc7c855168f91b0835ad93e526 (focal)
7:25:38 PM: buildbot version: 782b5df339f214fc7c855168f91b0835ad93e526
7:25:38 PM: Fetching cached dependencies
7:25:38 PM: Starting to download cache of 10.5MB
7:25:38 PM: Finished downloading cache in 255ms
7:25:38 PM: Starting to extract cache
7:25:38 PM: Finished extracting cache in 45ms
7:25:38 PM: Finished fetching cache in 349ms
7:25:38 PM: Starting to prepare the repo for build
7:25:38 PM: Preparing Git Reference refs/heads/deploy
7:25:39 PM: Parsing package.json dependencies
7:25:40 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: ‘diagram-app’ versus ‘diagram-app/’ in the Netlify UI
7:25:40 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘diagram-app/build’ versus ‘build’ in the Netlify UI
7:25:41 PM: Starting build script
7:25:41 PM: Installing dependencies
7:25:41 PM: Python version set to 2.7
7:25:41 PM: v16.19.1 is already installed.
7:25:41 PM: Now using node v16.19.1 (npm v8.19.3)
7:25:41 PM: Enabling Node.js Corepack
7:25:41 PM: Started restoring cached build plugins
7:25:41 PM: Finished restoring cached build plugins
7:25:42 PM: Attempting Ruby version 2.7.2, read from environment
7:25:42 PM: Using Ruby version 2.7.2
7:25:42 PM: Using PHP version 8.0
7:25:42 PM: Started restoring cached corepack dependencies
7:25:42 PM: Finished restoring cached corepack dependencies
7:25:42 PM: No npm workspaces detected
7:25:42 PM: Started restoring cached node modules
7:25:42 PM: Finished restoring cached node modules
7:25:43 PM: Installing npm packages using npm version 8.19.3
7:25:47 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform’s native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
7:25:48 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
7:25:48 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
7:25:50 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
7:25:55 PM: added 1422 packages, and audited 1423 packages in 12s
7:25:55 PM: 233 packages are looking for funding
7:25:55 PM: run npm fund for details
7:25:55 PM: 6 high severity vulnerabilities
7:25:55 PM: To address all issues (including breaking changes), run:
7:25:55 PM: npm audit fix --force
7:25:55 PM: Run npm audit for details.
7:25:55 PM: npm packages installed
7:25:55 PM: Started restoring cached go cache
7:25:55 PM: Finished restoring cached go cache
7:25:55 PM: go version go1.19.7 linux/amd64
7:25:55 PM: Detected 1 framework(s)
7:25:55 PM: “create-react-app” at version “5.0.1”
7:25:55 PM: Section completed: initializing
7:25:57 PM: ​
7:25:57 PM: Netlify Build
7:25:57 PM: ────────────────────────────────────────────────────────────────
7:25:57 PM: ​
7:25:57 PM: ❯ Version
7:25:57 PM: @netlify/build 29.7.0
7:25:57 PM: ​
7:25:57 PM: ❯ Flags
7:25:57 PM: baseRelDir: true
7:25:57 PM: buildId: 6418b32f199ff40009a8cb19
7:25:57 PM: deployId: 6418b32f199ff40009a8cb1b
7:25:57 PM: ​
7:25:57 PM: ❯ Current directory
7:25:57 PM: /opt/build/repo/diagram-app
7:25:57 PM: ​
7:25:57 PM: ❯ Config file
7:25:57 PM: No config file was defined: using default values.
7:25:57 PM: ​
7:25:57 PM: ❯ Context
7:25:57 PM: production
7:25:57 PM: ​
7:25:57 PM: 1. Build command from Netlify app
7:25:57 PM: ────────────────────────────────────────────────────────────────
7:25:57 PM: ​
7:25:57 PM: $ npm install && CI= npm run build
7:26:00 PM: up to date, audited 1423 packages in 2s
7:26:00 PM: 233 packages are looking for funding
7:26:00 PM: run npm fund for details
7:26:00 PM: 6 high severity vulnerabilities
7:26:00 PM: To address all issues (including breaking changes), run:
7:26:00 PM: npm audit fix --force
7:26:00 PM: Run npm audit for details.
7:26:00 PM: > diagram-app@0.1.0 build
7:26:00 PM: > react-scripts build
7:26:01 PM: Creating an optimized production build…
7:26:02 PM: Failed to compile.
7:26:02 PM:
7:26:02 PM: Module not found: Error: Can’t resolve ‘./Components/Toolbar’ in ‘/opt/build/repo/diagram-app/src’
7:26:02 PM: ​
7:26:02 PM: “build.command” failed
7:26:02 PM: ────────────────────────────────────────────────────────────────
7:26:02 PM: ​
7:26:02 PM: Error message
7:26:02 PM: Command failed with exit code 1: npm install && CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
7:26:02 PM: ​
7:26:02 PM: Error location
7:26:02 PM: In Build command from Netlify app:
7:26:02 PM: npm install && CI= npm run build
7:26:02 PM: ​
7:26:02 PM: Resolved config
7:26:02 PM: build:
7:26:02 PM: base: /opt/build/repo/diagram-app
7:26:02 PM: command: npm install && CI= npm run build
7:26:02 PM: commandOrigin: ui
7:26:02 PM: environment:
7:26:02 PM: - NETLIFY_GRAPH_TOKEN
7:26:02 PM: - ONEGRAPH_AUTHLIFY_TOKEN
7:26:02 PM: publish: /opt/build/repo/diagram-app/build
7:26:02 PM: publishOrigin: ui
7:26:03 PM: Caching artifacts
7:26:03 PM: Started saving node modules
7:26:03 PM: Finished saving node modules
7:26:03 PM: Started saving build plugins
7:26:03 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)
7:26:03 PM: Finished saving build plugins
7:26:03 PM: Started saving corepack cache
7:26:03 PM: Finished saving corepack cache
7:26:03 PM: Started saving pip cache
7:26:03 PM: Finished saving pip cache
7:26:03 PM: Started saving emacs cask dependencies
7:26:03 PM: Finished saving emacs cask dependencies
7:26:03 PM: Started saving maven dependencies
7:26:03 PM: Finished saving maven dependencies
7:26:03 PM: Started saving boot dependencies
7:26:03 PM: Finished saving boot dependencies
7:26:03 PM: Started saving rust rustup cache
7:26:03 PM: Finished saving rust rustup cache
7:26:03 PM: Started saving go dependencies
7:26:03 PM: Finished saving go dependencies
7:26:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:26:03 PM: Failing build: Failed to build site
7:26:03 PM: Finished processing build request in 25.792s

Hiya @Aldo :wave:t6: welcome to the forums. I recommend you look through this resource? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share the following information:

  • any error messages you have received in your terminal window or in the developer console

Thanks very much for this! I fixed the issue - it was Github’s case insensitivity - [Support Guide] Netlify app builds locally but fails on deploy (case sensitivity)

Hi @Aldo :wave:t6: ,

Thanks for coming back and confirming.