Skip to content

Next 15 | Build fails: Can't resolve next/dist/server/route-modules/app-page/vendored/contexts/html-contextΒ #72231

@antoinekm

Description

@antoinekm

Link to the code that reproduces this issue

tonightpass/kitchn#749

To Reproduce

  1. Install dependencies with pnpm install
  2. Run pnpm build
  3. Observe the build failure with the above error

Current vs. Expected behavior

The build should complete successfully without any module resolution errors.

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 22.6.0: Wed Jul 31 21:42:48 PDT 2024; root:xnu-8796.141.3.707.4~1/RELEASE_X86_64
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.19.0
  npm: 10.2.3
  Yarn: N/A
  pnpm: 9.12.3
Relevant Packages:
  next: 15.0.2 // Latest available version is detected (15.0.2).
  eslint-config-next: 15.0.2
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.2
Next.js Config:
  output: N/A

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

Pages Router

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

next build (local)

Additional context

When trying to build my Next.js project using next build, I'm encountering a module resolution error. The build process fails with the following error:

Failed to compile.

../node_modules/.pnpm/next@15.0.2_@[babel+core@7.26.0_react-dom](mailto:babel+core@7.26.0_react-dom)@[18.3.1_react@18.3.1__react](mailto:18.3.1_react@18.3.1__react)@18.3.1/node_modules/next/dist/pages/_document.js
Module not found: Can't resolve 'next/dist/server/route-modules/app-page/vendored/contexts/html-context'

[https://nextjs.org/docs/messages/module-not-found](https://nextjs.org/docs/messages/module-not-found)

Import trace for requested module:
../node_modules/.pnpm/next@15.0.2_@[babel+core@7.26.0_react-dom](mailto:babel+core@7.26.0_react-dom)@[18.3.1_react@18.3.1__react](mailto:18.3.1_react@18.3.1__react)@18.3.1/node_modules/next/dist/api/document.js
../packages/kitchn/dist/next/index.esm.js

> Build failed because of webpack errors

Any assistance or guidance on resolving this issue would be greatly appreciated. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pages RouterRelated to Pages Router.bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions