vercel/next.js · critical · Error

@rspack/core is not available. Please make sure the appropri

Error message

@rspack/core is not available. Please make sure the appropriate Next.js plugin is installed.

What it means

Thrown when NEXT_RSPACK is set so Next.js attempts to use Rspack as the bundler, but the require('next-rspack/rspack-core') call fails with MODULE_NOT_FOUND. The webpack shim getRspackCore() catches the missing-module error and re-throws this user-facing message, telling the developer the Rspack plugin/binding is not installed.

Source

Thrown at packages/next/src/bundles/webpack/packages/webpack.js:44

    // eslint-disable-next-line import/no-extraneous-dependencies
    StringXor: require('webpack/lib/util/StringXor'),
    // eslint-disable-next-line import/no-extraneous-dependencies
    NormalModule: require('webpack/lib/NormalModule'),
    // eslint-disable-next-line import/no-extraneous-dependencies
    sources: require('webpack').sources,
    // eslint-disable-next-line import/no-extraneous-dependencies
    webpack: require('webpack'),
  })
} else {
  Object.assign(exports, require('./bundle5')())
}

function getRspackCore() {
  try {
    return require('next-rspack/rspack-core')
  } catch (e) {
    if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
      throw new Error(
        '@rspack/core is not available. Please make sure the appropriate Next.js plugin is installed.'
      )
    }

    throw e
  }
}

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Install the required Rspack package: `pnpm add @next/rspack-core` (or the documented @next/rspack plugin for your Next.js version).
  2. Re-run `pnpm install` (or npm/yarn equivalent) after a branch switch to materialize the optional native binding.
  3. Unset NEXT_RSPACK if you did not intend to use Rspack — Next.js will fall back to the bundled webpack/Turbopack path.
  4. Verify the installed @next/rspack-core version matches the Next.js major version to avoid resolution failures.

Example fix

# before: NEXT_RSPACK=1 in env but package missing
# command
NEXT_RSPACK=1 pnpm build
# after: install the binding first
pnpm add @next/rspack-core
NEXT_RSPACK=1 pnpm build
Defensive patterns

Strategy: validation

Validate before calling

// Verify the rspack binding resolves before building
function assertRspackAvailable() {
  if (!process.env.NEXT_RSPACK) return
  try { require.resolve('next-rspack/rspack-core') }
  catch { throw new Error('NEXT_RSPACK set but next-rspack/rspack-core not installed') }
}

Type guard

function rspackInstalled(): boolean {
  try { require.resolve('next-rspack/rspack-core'); return true }
  catch { return false }
}

Prevention

When it happens

Trigger: The environment variable NEXT_RSPACK is truthy (often set by the @next/rspack plugin or a CI flag) but the @next/rspack-core / next-rspack package providing rspack-core is absent from node_modules. Also triggered by manually exporting NEXT_RSPACK=1 without installing the matching plugin.

Common situations: Opting into the Rspack experiment without running the install step; partial install after a branch switch (pnpm install not re-run); version skew between next and @next/rspack-binding; or a stale lockfile that dropped the optional native dependency. Also seen in monorepos where the plugin is hoisted incorrectly.

Related errors


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