{"record":{"id":"b7ad1868f896bff5","repo":"cypress-io/cypress","slug":"cypress-cannot-compile-your-next-js-application-wh","errorCode":null,"errorMessage":"Cypress cannot compile your Next.js application when \"nodeVersion\" is set to \"bundled\". Please remove this option from your Cypress configuration file.","messagePattern":"Cypress cannot compile your Next\\.js application when \"nodeVersion\" is set to \"bundled\"\\. Please remove this option from your Cypress configuration file\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/webpack-dev-server/src/helpers/nextHandler.ts","lineNumber":184,"sourceCode":"/**\n * Check if Next is using the SWC compiler. Compilation will fail if user has `nodeVersion: \"bundled\"` set\n * due to SWC certificate issues.\n */\nfunction checkSWC (\n  webpackConfig: Configuration,\n  cypressConfig: Cypress.PluginConfigOptions,\n) {\n  const hasSWCLoader = webpackConfig.module?.rules?.some((rule) => {\n    return typeof rule !== 'string' && rule.oneOf?.some(\n      (oneOf) => (oneOf.use as any)?.loader === 'next-swc-loader',\n    )\n  })\n\n  // \"resolvedNodePath\" is only set when using the user's Node.js, which is required to compile Next.js with SWC optimizations\n  // If it is not set, they have either explicitly set \"nodeVersion\" to \"bundled\" or are are using Cypress < 9.0.0 where it was set to \"bundled\" by default\n  // @ts-expect-error nodeVersion has been removed as of 13.0.0 however this plugin can be used with many versions of cypress\n  if (hasSWCLoader && cypressConfig.nodeVersion === 'bundled') {\n    throw new Error(`Cypress cannot compile your Next.js application when \"nodeVersion\" is set to \"bundled\". Please remove this option from your Cypress configuration file.`)\n  }\n\n  return false\n}\n\nconst exists = async (file: string) => {\n  try {\n    await fs.promises.access(file, fs.constants.F_OK)\n\n    return true\n  } catch (_) {\n    return false\n  }\n}\n\n/**\n * Next allows the `pages` directory to be located at either\n * `${projectRoot}/pages` or `${projectRoot}/src/pages`.","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/webpack-dev-server/src/helpers/nextHandler.ts#L166-L202","documentation":"Thrown by checkForSWCLoader when the user's webpackConfig contains a next-swc-loader rule AND the Cypress config has nodeVersion set to 'bundled'. SWC compilation requires the user's native Node because the SWC binary and bindings must match the runtime; the bundled Node in older Cypress (< 9.0.0) or an explicit nodeVersion: 'bundled' setting cannot load the SWC native bindings, so Cypress refuses to compile rather than emitting cryptic native-module errors.","triggerScenarios":"A Next.js project using SWC (default since Next 12) where the user explicitly set `nodeVersion: 'bundled'` in cypress.config.ts/jonfig.js, or a Cypress < 9.0.0 install where bundled was the default. The check walks webpackConfig.module.rules looking for any oneOf whose use.loader === 'next-swc-loader'.","commonSituations":"Upgrading from Cypress 8 to a newer Cypress and copying over old config that still sets nodeVersion: 'bundled'; using a Next.js app with default SWC and not realizing bundled Node cannot load SWC bindings.","solutions":["Remove the `nodeVersion: 'bundled'` line from your Cypress config (it is deprecated since 9.0.0).","If you need an explicit nodeVersion, use the user's resolved Node (do not set the option, or set nodeVersion: null in older APIs).","Upgrade Cypress to >= 9.0.0 if you are on an older version where bundled was the default.","Confirm the resolved node binary matches the platform of the SWC native binding (`npx cypress info`)."],"exampleFix":"// before (cypress.config.ts)\nexport default defineConfig({\n  e2e: { nodeVersion: 'bundled', setupNodeEvents() {} },\n})\n// after\nexport default defineConfig({\n  e2e: { setupNodeEvents() {} },\n})","handlingStrategy":"validation","validationCode":"import { readFileSync } from 'fs'\n\nfunction hasBundledNodeVersion (configPath: string): boolean {\n  const src = readFileSync(configPath, 'utf8')\n  return /nodeVersion\\s*:\\s*['\"]bundled['\"]/.test(src)\n}\n\nif (hasBundledNodeVersion('./cypress.config.ts')) {\n  console.warn('Remove nodeVersion: \"bundled\" — it breaks Next.js SWC compilation.')\n}","typeGuard":"function isBundledNodeVersion (cfg: any): boolean {\n  return cfg?.nodeVersion === 'bundled'\n}","tryCatchPattern":null,"preventionTips":["Never set nodeVersion in Cypress >= 9 configs.","Audit old configs during Cypress upgrades for the deprecated option.","Document that SWC requires the user's Node when onboarding Next.js projects."],"tags":["nextjs","swc","configuration","node-version","dev-server"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}