{"record":{"id":"4b0bb6ca77bd07b6","repo":"cypress-io/cypress","slug":"failed-to-load-next-dist-build-webpack-config-wi","errorCode":null,"errorMessage":"Failed to load \"next/dist/build/webpack-config\" with error: ${ e.message ?? e}","messagePattern":"Failed to load \"next/dist/build/webpack-config\" with error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/webpack-dev-server/src/helpers/nextHandler.ts","lineNumber":65,"sourceCode":"  } catch (e: any) {\n    // installBindings doesn't exist in Next.js < 16.0.3, which is fine\n    debug('installBindings not available (Next.js < 16.0.3): %s', e.message ?? e)\n  }\n\n  try {\n    const loadConfigPath = require.resolve('next/dist/server/config', resolvePaths)\n\n    packages.loadConfig = require(loadConfigPath).default\n  } catch (e: any) {\n    throw new Error(`Failed to load \"next/dist/server/config\" with error: ${e.message ?? e}`)\n  }\n\n  try {\n    const getNextJsBaseWebpackConfigPath = require.resolve('next/dist/build/webpack-config', resolvePaths)\n\n    packages.getNextJsBaseWebpackConfig = require(getNextJsBaseWebpackConfigPath).default\n  } catch (e: any) {\n    throw new Error(`Failed to load \"next/dist/build/webpack-config\" with error: ${ e.message ?? e}`)\n  }\n\n  try {\n    const loadJsConfigPath = require.resolve('next/dist/build/load-jsconfig', resolvePaths)\n\n    packages.nextLoadJsConfig = require(loadJsConfigPath).default\n  } catch (e: any) {\n    throw new Error(`Failed to load \"next/dist/build/load-jsconfig\" with error: ${ e.message ?? e}`)\n  }\n\n  // Does not exist prior to Next 13.\n  try {\n    const getUtilsPath = require.resolve('next/dist/build/utils', resolvePaths)\n\n    packages.getSupportedBrowsers = require(getUtilsPath).getSupportedBrowsers ?? (() => Promise.resolve([]))\n  } catch (e: any) {\n    throw new Error(`Failed to load \"next/dist/build/utils\" with error: ${ e.message ?? e}`)\n  }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/webpack-dev-server/src/helpers/nextHandler.ts#L47-L83","documentation":"Thrown by the Next.js handler when require.resolve('next/dist/build/webpack-config', resolvePaths) fails or the default export cannot be loaded. Cypress uses getNextJsBaseWebpackConfig to obtain the base webpack configuration Next.js itself produces, then merges Cypress-specific entries/loaders into it. Loss of this module means Cypress cannot reuse Next's compiled webpack rules.","triggerScenarios":"Next.js is installed but the dist/build/webpack-config file is missing (rare internal layout change), or the require throws because of a missing transitive dependency of the webpack-config module. Distinct from error 43 because the config-loading step already succeeded before this one runs.","commonSituations":"Next.js major version change where build/webpack-config was refactored (e.g. moving to turbopack-only layouts), partial install, or a Next.js canary build that omitted the file.","solutions":["Pin to a stable, supported Next.js version (avoid canary if the file is missing).","Reinstall node_modules to repair a partial Next.js install: `rm -rf node_modules && npm install`.","Check Next.js release notes for the installed version; if webpack-config moved, downgrade/upgrade to a Cypress-supported range.","Verify `require.resolve('next/dist/build/webpack-config')` succeeds from your project root in a plain Node REPL."],"exampleFix":"# diagnostic\nnode -e \"console.log(require.resolve('next/dist/build/webpack-config'))\"\n# if it throws, reinstall next at a known-good version\nnpm install --save-dev next@14.2.0","handlingStrategy":"validation","validationCode":"function assertNextWebpackConfig (resolvePaths: string[]) {\n  require.resolve('next/dist/build/webpack-config', { paths: resolvePaths })\n}","typeGuard":"function isNextWebpackConfigResolvable (resolvePaths: string[]): boolean {\n  try { require.resolve('next/dist/build/webpack-config', { paths: resolvePaths }); return true }\n  catch { return false }\n}","tryCatchPattern":null,"preventionTips":["Avoid Next.js canary builds for Cypress runs.","Verify the file exists after install: `ls node_modules/next/dist/build/webpack-config.js`.","Keep Next.js within a Cypress-supported version range."],"tags":["nextjs","dependency-resolution","webpack","dev-server"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}