vercel/next.js · error · Error

It looks like you're trying to use Partytown with next/scrip

Error message

It looks like you're trying to use Partytown with next/script but do not have the required package(s) installed.

Please install Partytown by running:

	${pkg manager install cmd} @builder.io/partytown

If you are not trying to use Partytown, please disable the experimental "nextScriptWorkers" flag in next.config.js.

What it means

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.

Source

Thrown at packages/next/src/lib/verify-partytown-setup.ts:14

import { promises } from 'fs'
import { bold, cyan, red } from './picocolors'

import path from 'path'
import { hasNecessaryDependencies } from './has-necessary-dependencies'
import type { NecessaryDependencies } from './has-necessary-dependencies'
import { fileExists, FileType } from './file-exists'
import * as Log from '../build/output/log'
import { getPkgManager } from './helpers/get-pkg-manager'

async function missingDependencyError(dir: string) {
  const packageManager = getPkgManager(dir)

  throw new Error(
    bold(
      red(
        "It looks like you're trying to use Partytown with next/script but do not have the required package(s) installed."
      )
    ) +
      '\n\n' +
      bold(`Please install Partytown by running:`) +
      '\n\n' +
      `\t${bold(
        cyan(
          (packageManager === 'yarn'
            ? 'yarn add --dev'
            : packageManager === 'pnpm'
              ? 'pnpm install --save-dev'
              : 'npm install --save-dev') + ' @builder.io/partytown'
        )
      )}` +
      '\n\n' +

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Install the package: `npm install --save-dev @builder.io/partytown` (or the yarn/pnpm equivalent shown in the message).
  2. If you no longer want Partytown, remove `experimental.nextScriptWorkers` from next.config.js.
  3. Re-run the build after installing to let Next.js copy the ~partytown static files.

Example fix

// before (next.config.js)
module.exports = { experimental: { nextScriptWorkers: true } }
// after - option A: install the package
//   npm install --save-dev @builder.io/partytown
// after - option B: disable the flag
module.exports = { experimental: {} }
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs'
import { resolve } from 'path'
function ensurePartytownPresent(projectDir: string) {
  if (!existsSync(resolve(projectDir, 'node_modules/@builder.io/partytown/package.json'))) {
    throw new Error('Install @builder.io/partytown before enabling nextScriptWorkers')
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Following a tutorial that enables nextScriptWorkers without the install step; installing partytown in the wrong workspace; clearing node_modules and forgetting to reinstall.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/2d11c85fd51fd564. Report an issue: GitHub.