Skip to content

An error occurred in next/font. TypeError: Cannot read properties of undefined (reading 'ascent') #69748

Closed
@chris-garrett

Description

@chris-garrett

Link to the code that reproduces this issue

https://github.com/chris-garrett/next-font-issue

To Reproduce

Create a new app and run pnpm dev

npx -y create-next-app@latest \
  next-font-issue \
  --yes \
  --typescript \
  --app \
  --eslint \
  --import-alias "@acme/*" \
  --src-dir \
  --use-pnpm \
  --turbo \
  --tailwind

Current vs. Expected behavior

I would expect a new app created with create-next-app and unmodified to run without errors.

Provide environment information

$ npx --no-install next info

Operating System:
  Platform: linux
  Arch: x64
  Version: #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
  Available memory (MB): 64212
  Available CPU cores: 24
Binaries:
  Node: 21.5.0
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: 9.8.0
Relevant Packages:
  next: 14.2.8 // Latest available version is detected (14.2.8).
  eslint-config-next: 14.2.8
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

create-next-app

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

An error occurred in `next/font`.

TypeError: Cannot read properties of undefined (reading 'ascent')
    at get ascent [as ascent] (/home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@next/font/dist/fontkit/index.js:1:797933)
    at getFallbackMetricsFromFontFile (/home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@next/font/dist/local/get-fallback-metrics-from-font-file.js:73:13)
    at nextFontLocalFontLoader (/home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/@next/font/dist/local/loader.js:63:114)
    at async Span.traceAsyncFn (/home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/trace/trace.js:154:20)
    at async /home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js:76:87
    at async Span.traceAsyncFn (/home/chris/projects/next-font-issue/node_modules/.pnpm/next@14.2.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/trace/trace.js:154:20)
 GET / 500 in 1703ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.create-next-appRelated to our CLI tool for quickly starting a new Next.js application.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions