Build Fails: webpack config.resolve.alias was incorrectly overridden

I’m constantly getting a failed build because of ‘webpack config.resolve.alias was incorrectly overridden.’ (I think… I’m new to all of this). I read about case sensitive errors, but I still wasn’t sure what to do. I’m not using the CLI- builds trigger from git push

I’m using next.js and work off of a mac (re: case sensitivity issues). I’ve been trying to figure out what’s up for two days now and am at a loss =[

git: https://github.com/jordanlambrecht/pb-oct-2022/tree/test/components

logs:

10:49:22 PM: Waiting for other deploys from your team to complete. Check the queue: https://app.netlify.com/teams/jordanlambrecht/builds
10:53:22 PM: Build ready to start
10:53:24 PM: build-image version: a6bb34428a07e7de82f4df5dfe1843fbde91f670 (focal)
10:53:24 PM: build-image tag: v4.5.1
10:53:24 PM: buildbot version: ab5da211e6eeae701db03e18619b2fc5572ed90a
10:53:25 PM: Fetching cached dependencies
10:53:25 PM: Failed to fetch cache, continuing with build
10:53:25 PM: Starting to prepare the repo for build
10:53:25 PM: No cached dependencies found. Cloning fresh repo
10:53:25 PM: git clone https://github.com/jordanlambrecht/pb-oct-2022
10:53:29 PM: Preparing Git Reference refs/heads/test
10:53:30 PM: Parsing package.json dependencies
10:53:31 PM: Starting build script
10:53:31 PM: Installing dependencies
10:53:31 PM: Python version set to 2.7
10:53:32 PM: v16.13.1 is already installed.
10:53:33 PM: Now using node v16.13.1 (npm v8.1.2)
10:53:33 PM: Started restoring cached build plugins
10:53:33 PM: Finished restoring cached build plugins
10:53:33 PM: Attempting ruby version 2.7.2, read from environment
10:53:35 PM: Using ruby version 2.7.2
10:53:36 PM: Using PHP version 8.0
10:53:36 PM: Started restoring cached yarn cache
10:53:36 PM: Finished restoring cached yarn cache
10:53:36 PM: No yarn workspaces detected
10:53:36 PM: Started restoring cached node modules
10:53:36 PM: Finished restoring cached node modules
10:53:37 PM: Installing NPM modules using Yarn version 1.22.10
10:53:37 PM: yarn install v1.22.10
10:53:38 PM: [1/4] Resolving packages...
10:53:38 PM: [2/4] Fetching packages...
10:54:09 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
10:54:09 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-android-arm64@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-android-arm64@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-android-arm64@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info @next/swc-darwin-arm64@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-darwin-arm64@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-darwin-arm64@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info @next/swc-darwin-x64@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-darwin-x64@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-linux-arm-gnueabihf@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info "@next/swc-linux-arm-gnueabihf@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-linux-arm64-gnu@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info "@next/swc-linux-arm64-gnu@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-linux-arm64-musl@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info "@next/swc-linux-arm64-musl@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-win32-arm64-msvc@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-win32-arm64-msvc@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-win32-arm64-msvc@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info @next/swc-win32-ia32-msvc@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-win32-ia32-msvc@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: info @next/swc-win32-ia32-msvc@12.0.7: The CPU architecture "x64" is incompatible with this module.
10:54:09 PM: info @next/swc-win32-x64-msvc@12.0.7: The platform "linux" is incompatible with this module.
10:54:09 PM: info "@next/swc-win32-x64-msvc@12.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
10:54:09 PM: [3/4] Linking dependencies...
10:54:09 PM: warning " > @next/react-refresh-utils@12.0.7" has unmet peer dependency "react-refresh@0.8.3".
10:54:09 PM: warning "next > styled-jsx > @babel/plugin-syntax-jsx@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".
10:54:19 PM: [4/4] Building fresh packages...
10:54:23 PM: Done in 45.78s.
10:54:23 PM: NPM modules installed using Yarn
10:54:24 PM: Started restoring cached go cache
10:54:24 PM: Finished restoring cached go cache
10:54:24 PM: go version go1.16.5 linux/amd64
10:54:24 PM: go version go1.16.5 linux/amd64
10:54:24 PM: Installing missing commands
10:54:24 PM: Verify run directory
10:54:26 PM: ​
10:54:26 PM: ────────────────────────────────────────────────────────────────
10:54:26 PM:   Netlify Build                                                 
10:54:26 PM: ────────────────────────────────────────────────────────────────
10:54:26 PM: ​
10:54:26 PM: ❯ Version
10:54:26 PM:   @netlify/build 20.3.0
10:54:26 PM: ​
10:54:26 PM: ❯ Flags
10:54:26 PM:   baseRelDir: true
10:54:26 PM:   buildId: 61b57f52268d1100078767f6
10:54:26 PM:   deployId: 61b57f52268d1100078767f8
10:54:26 PM: ​
10:54:26 PM: ❯ Current directory
10:54:26 PM:   /opt/build/repo
10:54:26 PM: ​
10:54:26 PM: ❯ Config file
10:54:26 PM:   No config file was defined: using default values.
10:54:26 PM: ​
10:54:26 PM: ❯ Context
10:54:26 PM:   production
10:54:26 PM: ​
10:54:26 PM: ❯ Loading plugins
10:54:26 PM:    - @netlify/plugin-nextjs@3.9.2 from Netlify app and package.json
10:54:27 PM: ​
10:54:27 PM: ────────────────────────────────────────────────────────────────
10:54:27 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
10:54:27 PM: ────────────────────────────────────────────────────────────────
10:54:27 PM: ​
10:54:27 PM: Using Next.js 12.0.7
10:54:27 PM: Warning: support for Next.js >=11.1.0 is experimental
10:54:27 PM: The "target" config property must be one of "serverless", "experimental-serverless-trace". Building with "serverless" target.
10:54:27 PM: No Next.js cache to restore.
10:54:27 PM: ​
10:54:27 PM: (@netlify/plugin-nextjs onPreBuild completed in 669ms)
10:54:27 PM: ​
10:54:27 PM: ────────────────────────────────────────────────────────────────
10:54:27 PM:   2. Build command from Netlify app                             
10:54:27 PM: ────────────────────────────────────────────────────────────────
10:54:27 PM: ​
10:54:27 PM: $ yarn build
10:54:28 PM: yarn run v1.22.10
10:54:28 PM: $ next build
10:54:29 PM: info  - Skipping validation of types...
10:54:29 PM: info  - Creating an optimized production build...
10:55:40 PM: Failed to compile.
10:55:40 PM: 
10:55:40 PM: ./node_modules/@next/react-refresh-utils/ReactRefreshWebpackPlugin.js
10:55:40 PM: Module not found: Can't resolve 'webpack' in '/opt/build/repo/node_modules/@next/react-refresh-utils'
10:55:40 PM: Import trace for requested module:
10:55:40 PM: ./node_modules/next/dist/build/webpack-config.js
10:55:40 PM: ./node_modules/next/dist/server/dev/hot-reloader.js
10:55:40 PM: ./node_modules/next/dist/server/dev/next-dev-server.js
10:55:40 PM: ./node_modules/next/dist/server/next.js
10:55:40 PM: ./components/About/About_Team.jsx
10:55:40 PM: ./pages/about/index.tsx
10:55:40 PM: ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fabout&absolutePagePath=private-next-pages%2Fabout%2Findex.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=private-next-pages%2F_document.tsx&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=&distDir=private-dot-next&buildId=jH8CEQa4vVMlcpDcciHlL&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%2243bd74f2c7694a6a5463dbbfb0998cd1%22%2C%22previewModeSigningKey%22%3A%22ae081ddf1bf8b3f99513b9272ba07bbceea7cdd90b88a9c4ac1ce3b5288bfc05%22%2C%22previewModeEncryptionKey%22%3A%22203c0947a10f37129dc94e3edfb8443780437c4fa4e3a08ca1290da85f527091%22%7D&loadedEnvFiles=W10%3D&i18n=!
10:55:40 PM: ./node_modules/@next/swc-linux-x64-gnu/README.md
10:55:40 PM: Module parse failed: Unexpected character ' ' (1:1)
10:55:40 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
10:55:40 PM: > # `@next/swc-linux-x64-gnu`
10:55:40 PM: |
10:55:40 PM: | This is the **x86_64-unknown-linux-gnu** binary for `@next/swc`
10:55:40 PM: Import trace for requested module:
10:55:40 PM: ./node_modules/@next/ sync ^\.\/swc\-.*$
10:55:40 PM: ./node_modules/next/dist/build/swc/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack-config.js
10:55:40 PM: ./node_modules/next/dist/server/dev/hot-reloader.js
10:55:40 PM: ./node_modules/next/dist/server/dev/next-dev-server.js
10:55:40 PM: ./node_modules/next/dist/server/next.js
10:55:40 PM: ./components/About/About_Team.jsx
10:55:40 PM: ./pages/about/index.tsx
10:55:40 PM: ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fabout&absolutePagePath=private-next-pages%2Fabout%2Findex.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=private-next-pages%2F_document.tsx&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=&distDir=private-dot-next&buildId=jH8CEQa4vVMlcpDcciHlL&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%2243bd74f2c7694a6a5463dbbfb0998cd1%22%2C%22previewModeSigningKey%22%3A%22ae081ddf1bf8b3f99513b9272ba07bbceea7cdd90b88a9c4ac1ce3b5288bfc05%22%2C%22previewModeEncryptionKey%22%3A%22203c0947a10f37129dc94e3edfb8443780437c4fa4e3a08ca1290da85f527091%22%7D&loadedEnvFiles=W10%3D&i18n=!
10:55:40 PM: ./node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node
10:55:40 PM: Module parse failed: Unexpected character '' (1:0)
10:55:40 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
10:55:40 PM: (Source code omitted for this binary file)
10:55:40 PM: Import trace for requested module:
10:55:40 PM: ./node_modules/@next/ sync ^\.\/swc\-.*$
10:55:40 PM: ./node_modules/next/dist/build/swc/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack-config.js
10:55:40 PM: ./node_modules/next/dist/server/dev/hot-reloader.js
10:55:40 PM: ./node_modules/next/dist/server/dev/next-dev-server.js
10:55:40 PM: ./node_modules/next/dist/server/next.js
10:55:40 PM: ./components/About/About_Team.jsx
10:55:40 PM: ./pages/about/index.tsx
10:55:40 PM: ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fabout&absolutePagePath=private-next-pages%2Fabout%2Findex.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=private-next-pages%2F_document.tsx&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=&distDir=private-dot-next&buildId=jH8CEQa4vVMlcpDcciHlL&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%2243bd74f2c7694a6a5463dbbfb0998cd1%22%2C%22previewModeSigningKey%22%3A%22ae081ddf1bf8b3f99513b9272ba07bbceea7cdd90b88a9c4ac1ce3b5288bfc05%22%2C%22previewModeEncryptionKey%22%3A%22203c0947a10f37129dc94e3edfb8443780437c4fa4e3a08ca1290da85f527091%22%7D&loadedEnvFiles=W10%3D&i18n=!
10:55:40 PM: ./node_modules/@next/swc-linux-x64-musl/README.md
10:55:40 PM: Module parse failed: Unexpected character ' ' (1:1)
10:55:40 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
10:55:40 PM: > # `@next/swc-linux-x64-musl`
10:55:40 PM: |
10:55:40 PM: | This is the **linux-x64-musl** binary for `@next/swc`
10:55:40 PM: Import trace for requested module:
10:55:40 PM: ./node_modules/@next/ sync ^\.\/swc\-.*$
10:55:40 PM: ./node_modules/next/dist/build/swc/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack-config.js
10:55:40 PM: ./node_modules/next/dist/server/dev/hot-reloader.js
10:55:40 PM: ./node_modules/next/dist/server/dev/next-dev-server.js
10:55:40 PM: ./node_modules/next/dist/server/next.js
10:55:40 PM: ./components/About/About_Team.jsx
10:55:40 PM: ./pages/about/index.tsx
10:55:40 PM: ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fabout&absolutePagePath=private-next-pages%2Fabout%2Findex.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=private-next-pages%2F_document.tsx&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=&distDir=private-dot-next&buildId=jH8CEQa4vVMlcpDcciHlL&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%2243bd74f2c7694a6a5463dbbfb0998cd1%22%2C%22previewModeSigningKey%22%3A%22ae081ddf1bf8b3f99513b9272ba07bbceea7cdd90b88a9c4ac1ce3b5288bfc05%22%2C%22previewModeEncryptionKey%22%3A%22203c0947a10f37129dc94e3edfb8443780437c4fa4e3a08ca1290da85f527091%22%7D&loadedEnvFiles=W10%3D&i18n=!
10:55:40 PM: ./node_modules/@next/swc-linux-x64-musl/next-swc.linux-x64-musl.node
10:55:40 PM: Module parse failed: Unexpected character '' (1:0)
10:55:40 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
10:55:40 PM: (Source code omitted for this binary file)
10:55:40 PM: Import trace for requested module:
10:55:40 PM: ./node_modules/@next/ sync ^\.\/swc\-.*$
10:55:40 PM: ./node_modules/next/dist/build/swc/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/index.js
10:55:40 PM: ./node_modules/next/dist/build/webpack-config.js
10:55:40 PM: ./node_modules/next/dist/server/dev/hot-reloader.js
10:55:40 PM: ./node_modules/next/dist/server/dev/next-dev-server.js
10:55:40 PM: ./node_modules/next/dist/server/next.js
10:55:40 PM: ./components/About/About_Team.jsx
10:55:40 PM: ./pages/about/index.tsx
10:55:40 PM: ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fabout&absolutePagePath=private-next-pages%2Fabout%2Findex.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=private-next-pages%2F_document.tsx&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=&distDir=private-dot-next&buildId=jH8CEQa4vVMlcpDcciHlL&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%2243bd74f2c7694a6a5463dbbfb0998cd1%22%2C%22previewModeSigningKey%22%3A%22ae081ddf1bf8b3f99513b9272ba07bbceea7cdd90b88a9c4ac1ce3b5288bfc05%22%2C%22previewModeEncryptionKey%22%3A%22203c0947a10f37129dc94e3edfb8443780437c4fa4e3a08ca1290da85f527091%22%7D&loadedEnvFiles=W10%3D&i18n=!
10:55:40 PM: > webpack config.resolve.alias was incorrectly overridden. https://nextjs.org/docs/messages/invalid-resolve-alias
10:55:40 PM: error Command failed with exit code 1.
10:55:40 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:55:40 PM: ​
10:55:40 PM: ────────────────────────────────────────────────────────────────
10:55:40 PM:   "build.command" failed                                        
10:55:40 PM: ────────────────────────────────────────────────────────────────
10:55:40 PM: ​
10:55:40 PM:   Error message
10:55:40 PM:   Command failed with exit code 1: yarn build
10:55:40 PM: ​
10:55:40 PM:   Error location
10:55:40 PM:   In Build command from Netlify app:
10:55:40 PM:   yarn build
10:55:40 PM: ​
10:55:40 PM:   Resolved config
10:55:40 PM:   build:
10:55:40 PM:     command: yarn build
10:55:40 PM:     commandOrigin: ui
10:55:40 PM:     publish: /opt/build/repo/out
10:55:40 PM:     publishOrigin: ui
10:55:40 PM:   plugins:
10:55:40 PM:     - inputs: {}
10:55:40 PM:       origin: ui
10:55:40 PM:       package: '@netlify/plugin-nextjs'
10:55:41 PM: Caching artifacts
10:55:41 PM: Started saving node modules
10:55:41 PM: Finished saving node modules
10:55:41 PM: Started saving build plugins
10:55:41 PM: Finished saving build plugins
10:55:41 PM: Started saving yarn cache
10:55:47 PM: Finished saving yarn cache
10:55:47 PM: Started saving pip cache
10:55:47 PM: Finished saving pip cache
10:55:47 PM: Started saving emacs cask dependencies
10:55:47 PM: Finished saving emacs cask dependencies
10:55:47 PM: Started saving maven dependencies
10:55:47 PM: Finished saving maven dependencies
10:55:47 PM: Started saving boot dependencies
10:55:47 PM: Finished saving boot dependencies
10:55:47 PM: Started saving rust rustup cache
10:55:47 PM: Finished saving rust rustup cache
10:55:47 PM: Started saving go dependencies
10:55:47 PM: Finished saving go dependencies
10:55:49 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:55:49 PM: Creating deploy upload records
10:55:49 PM: Failing build: Failed to build site
10:55:49 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:55:49 PM: Finished processing build request in 2m25.025593039s

Hi @jordanlambrecht

Welcome to the Netlify forums :netliconfetti:

I’m not a Next user particularly but I have spotted on issue that exists in the test and staging branches. You have a file called

webpack.comfig.js

instead of

webpack.config.js

If this isn’t the cause of the issue, perhaps try adding webpack as a dependency in the package.json of your project/

I don’t believe this error is due to case sensitivity. From what I can see the case names of components is correct.

wow. good eyes. that’s embarrassing.

Sadly, though, neither options worked =/

Of course they didn’t work, that would make life easy! :upside_down_face:

After fudging an API key for Chec I can yarn dev ok. I got an error about media.pixelbakery.com not configured for next/image though.

Did some digging…

Turns out this issue has popped up before. Unforunately no resolution per se, though the last post in the thread does have someone of the workaround perhaps.

Another good catch =] thank you.

I actually saw that thread before posting, and didn’t get anywhere with it.

Webdev is hard.