Netlify build fails thinking a component isn't named properly, when it is

Hi there,

The build is fine when I build locally, fails on Netlify.

Trying to update a client site and the build keeps failing. It says that it can’t resolve a path to a component because it’s named differently or something, but it’s not. It’s the same name across every page, I’ve triple checked. Details below.

Github repo: GitHub - ggs-landscaping/ggs
Site: https://ggsland.netlify.app/

Build log:

8:09:19 PM: $ gatsby build

8:09:23 PM: success open and validate gatsby-configs - 0.094s

8:09:23 PM: success load plugins - 0.290s

8:09:23 PM: success onPreInit - 0.065s

8:09:23 PM: success delete html and css files from previous builds - 0.005s

8:09:23 PM: success initialize cache - 0.010s

8:09:23 PM: success copy gatsby files - 0.076s

8:09:23 PM: success onPreBootstrap - 0.018s

8:09:24 PM: success createSchemaCustomization - 0.002s

8:09:24 PM: success Checking for changed pages - 0.000s

8:09:24 PM: success source and transform nodes - 0.061s

8:09:24 PM: success building schema - 0.373s

8:09:24 PM: info Total nodes: 36, SitePage nodes: 1 (use --verbose for breakdown)

8:09:24 PM: success createPages - 0.007s

8:09:24 PM: success Checking for changed pages - 0.000s

8:09:24 PM: success createPagesStatefully - 0.149s

8:09:24 PM: success update schema - 0.031s

8:09:24 PM: success onPreExtractQueries - 0.001s

8:09:24 PM: success extract queries from components - 0.266s

8:09:24 PM: success write out redirect data - 0.007s

8:09:24 PM: success onPostBootstrap - 0.001s

8:09:24 PM: info bootstrap finished - 5.742s

8:09:24 PM: success run page queries - 0.016s - 10/10 631.45/s

8:09:25 PM: success write out requires - 0.005s

8:09:51 PM: warning chunk styles [mini-css-extract-plugin]

8:09:51 PM: Conflicting order. Following module has been added:

8:09:51 PM: * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/src??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./components/ImageButton/image-button.scss

8:09:51 PM: despite it was not able to fulfill desired ordering with these modules:

8:09:51 PM: * css ./node_modules/css-loader??ref--13-oneOf-1-1!./node_modules/postcss-loader/src??postcss-3!./node_modules/gatsby-plugin-sass/node_modules/sass-loader/dist/cjs.js??ref--13-oneOf-1-3!./components/Footer/footer.scss

8:09:51 PM: - couldn't fulfill desired order of chunk group(s) component---src-pages-portfolio-js
- while fulfilling desired order of chunk group(s) component---src-pages-index-js

8:09:51 PM: failed Building production JavaScript and CSS bundles - 26.752s

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: error Generating JavaScript bundles failed

8:09:51 PM: Can't resolve '../../components/Cta/Cta' in '/opt/build/repo/src/pages'

8:09:51 PM: If you're trying to use a package make sure that '../../components/Cta/Cta' is installed. If you're trying to use a local file make sure that the path is correct.

8:09:51 PM: ​

8:09:51 PM: ────────────────────────────────────────────────────────────────

8:09:51 PM: "build.command" failed

8:09:51 PM: ────────────────────────────────────────────────────────────────

8:09:51 PM: ​

8:09:51 PM: Error message

8:09:51 PM: Command failed with exit code 1: gatsby build

8:09:51 PM: ​

8:09:51 PM: Error location

8:09:51 PM: In Build command from Netlify app:

8:09:51 PM: gatsby build

8:09:51 PM: ​

8:09:51 PM: Resolved config

8:09:51 PM: build:

8:09:51 PM: command: gatsby build

8:09:51 PM: commandOrigin: ui

8:09:51 PM: publish: /opt/build/repo/public

8:09:51 PM: publishOrigin: ui

8:09:51 PM: plugins:

8:09:51 PM: - inputs: {}

8:09:51 PM: origin: ui

8:09:51 PM: package: '@netlify/plugin-gatsby'

8:09:52 PM: Caching artifacts

8:09:52 PM: Started saving node modules

8:09:52 PM: Finished saving node modules

8:09:52 PM: Started saving build plugins

8:09:52 PM: Finished saving build plugins

8:09:52 PM: Started saving yarn cache

8:10:02 PM: Finished saving yarn cache

8:10:02 PM: Started saving pip cache

8:10:02 PM: Finished saving pip cache

8:10:02 PM: Started saving emacs cask dependencies

8:10:02 PM: Finished saving emacs cask dependencies

8:10:02 PM: Started saving maven dependencies

8:10:02 PM: Finished saving maven dependencies

8:10:02 PM: Started saving boot dependencies

8:10:02 PM: Finished saving boot dependencies

8:10:02 PM: Started saving rust rustup cache

8:10:02 PM: Finished saving rust rustup cache

8:10:02 PM: Started saving go dependencies

8:10:02 PM: Finished saving go dependencies

8:10:05 PM: Build failed due to a user error: Build script returned non-zero exit code: 2

8:10:05 PM: Creating deploy upload records

8:10:05 PM: Failing build: Failed to build site

8:10:05 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2

8:10:05 PM: Finished processing build request in 3m0.313310178s

Hi @GGS-Landscaping

It is named differently.

However in your git repository the directory is CTA and the filename is cta.js. So in src/pages/index.js (and anywhere else you have imported this file) you need

import Cta from "../../components/CTA/cta"

Hi, @GGS-Landscaping. I want to go into more detail about @coelmay’s answer.

Some Windows and MacOS filesystems ignore letter case. On one of those filesystems, CTA and Cta can be used interchangeably. The build system is Linux. Most (not all but most) Linux filesystems are case-sensitive so mixing cases like this causes an error.

The solution will be to make sure to match any upper-case and lower-case letters exactly.

If that doesn’t resolve the issue, please let us know.

2 Likes

Thanks @coelmay and @luke , it was a naming issue after all. Thank you!

1 Like