{"record":{"id":"2d11c85fd51fd564","repo":"vercel/next.js","slug":"it-looks-like-you-re-trying-to-use-partytown-with","errorCode":null,"errorMessage":"It looks like you're trying to use Partytown with next/script but do not have the required package(s) installed.\n\nPlease install Partytown by running:\n\n\t${pkg manager install cmd} @builder.io/partytown\n\nIf you are not trying to use Partytown, please disable the experimental \"nextScriptWorkers\" flag in next.config.js.","messagePattern":"It looks like you're trying to use Partytown with next/script but do not have the required package\\(s\\) installed\\.\n\nPlease install Partytown by running:\n\n\t(.+?) @builder\\.io/partytown\n\nIf you are not trying to use Partytown, please disable the experimental \"nextScriptWorkers\" flag in next\\.config\\.js\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/verify-partytown-setup.ts","lineNumber":14,"sourceCode":"import { promises } from 'fs'\nimport { bold, cyan, red } from './picocolors'\n\nimport path from 'path'\nimport { hasNecessaryDependencies } from './has-necessary-dependencies'\nimport type { NecessaryDependencies } from './has-necessary-dependencies'\nimport { fileExists, FileType } from './file-exists'\nimport * as Log from '../build/output/log'\nimport { getPkgManager } from './helpers/get-pkg-manager'\n\nasync function missingDependencyError(dir: string) {\n  const packageManager = getPkgManager(dir)\n\n  throw new Error(\n    bold(\n      red(\n        \"It looks like you're trying to use Partytown with next/script but do not have the required package(s) installed.\"\n      )\n    ) +\n      '\\n\\n' +\n      bold(`Please install Partytown by running:`) +\n      '\\n\\n' +\n      `\\t${bold(\n        cyan(\n          (packageManager === 'yarn'\n            ? 'yarn add --dev'\n            : packageManager === 'pnpm'\n              ? 'pnpm install --save-dev'\n              : 'npm install --save-dev') + ' @builder.io/partytown'\n        )\n      )}` +\n      '\\n\\n' +","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/verify-partytown-setup.ts#L1-L32","documentation":"Thrown by missingDependencyError() in verify-partytown-setup.ts when the experimental `nextScriptWorkers` flag is enabled but the `@builder.io/partytown` package is not installed. Partytown runs third-party scripts in a web worker; Next.js needs the package present to copy its library files into the static directory.","triggerScenarios":"Enabling experimental.nextScriptWorkers: true in next.config.js without installing @builder.io/partytown. verifyPartytownSetup() runs during build/dev and calls hasNecessaryDependencies; if the package is missing it throws.","commonSituations":"Following a tutorial that enables nextScriptWorkers without the install step; installing partytown in the wrong workspace; clearing node_modules and forgetting to reinstall.","solutions":["Install the package: `npm install --save-dev @builder.io/partytown` (or the yarn/pnpm equivalent shown in the message).","If you no longer want Partytown, remove `experimental.nextScriptWorkers` from next.config.js.","Re-run the build after installing to let Next.js copy the ~partytown static files."],"exampleFix":"// before (next.config.js)\nmodule.exports = { experimental: { nextScriptWorkers: true } }\n// after - option A: install the package\n//   npm install --save-dev @builder.io/partytown\n// after - option B: disable the flag\nmodule.exports = { experimental: {} }","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs'\nimport { resolve } from 'path'\nfunction ensurePartytownPresent(projectDir: string) {\n  if (!existsSync(resolve(projectDir, 'node_modules/@builder.io/partytown/package.json'))) {\n    throw new Error('Install @builder.io/partytown before enabling nextScriptWorkers')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install @builder.io/partytown whenever you enable experimental.nextScriptWorkers.","Keep the flag and the package in sync in your README/setup script.","If you stop using Partytown, disable the flag to avoid this check."],"tags":["partytown","script","experimental","dependencies","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}