vercel/next.js · error

@next/font/google failed to run or is incorrectly configured

Error message

@next/font/google failed to run or is incorrectly configured.

Read more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts

What it means

`@next/font/google`'s fallback throw: after the version check passes, the file unconditionally throws this message because the package is a shim — the actual implementation lives inside `next` itself. Seeing this error means the shim's real entry was not patched/replaced by the installed Next.js build, i.e. `@next/font/google` was loaded but Next's loader did not intercept it. It points users to the font docs for correct configuration.

Source

Thrown at packages/font/google/index.js:15

// Validate next version
const semver = require('next/dist/compiled/semver')
if (semver.lt(require('next/package.json').version, '13.0.0')) {
  throw new Error('`@next/font` is only available in Next.js 13 and newer.')
}

let message = '@next/font/google failed to run or is incorrectly configured.'
if (process.env.NODE_ENV === 'development') {
  message +=
    '\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
}

message += `\n\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts`

throw new Error(message)

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Use the built-in `next/font/google` import directly — avoid `@next/font` entirely.
  2. If you just installed/updated, restart `next dev` (the message explicitly suggests this for dev).
  3. Remove `node_modules` and reinstall to clear a stale resolution that loads the shim.
  4. Confirm there is no conflicting local `@next/font` package or alias overriding the Next internal one.

Example fix

// before
import { Inter } from '@next/font/google'

// after
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
Defensive patterns

Strategy: fallback

Validate before calling

// Avoid the shim entirely; import from next/font/google.
// presence of the shim throwing means resolution mismatch.
try {
  require.resolve('next/font/google')
} catch {
  throw new Error('next/font not found; install Next 13.2+')
}

Type guard

function hasBuiltInFont(): boolean {
  try { require.resolve('next/font/google'); return true } catch { return false }
}

Prevention

When it happens

Trigger: Importing `@next/font/google` in a project where the package was installed standalone from npm (so it runs the shim) rather than being resolved through Next's internal alias; or where the Next build did not rewrite the import to `next/font/google`. The dev hint suggests restarting `next dev` after install.

Common situations: Installing `@next/font` from npm in a Next 13+ project where the aliasing should have made it work, but a stale module cache or wrong resolution root causes the shim to execute; bundler resolving the npm package instead of Next's internal copy.

Related errors


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