Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AntoineKM opened this issue Nov 3, 2024 · 5 comments
Labels
bug Issue was opened via the bug report template. Pages Router Related to Pages Router.

Comments

@AntoineKM
Copy link

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/[email protected]_@[[email protected]_react-dom](mailto:[email protected]_react-dom)@[[email protected]__react](mailto:[email protected]__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/[email protected]_@[[email protected]_react-dom](mailto:[email protected]_react-dom)@[[email protected]__react](mailto:[email protected]__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!

@AntoineKM AntoineKM added the bug Issue was opened via the bug report template. label Nov 3, 2024
@github-actions github-actions bot added the Pages Router Related to Pages Router. label Nov 3, 2024
@JesseKoldewijn
Copy link
Contributor

Please provide a reproduction and not a link to a PR ;)

@AntoineKM
Copy link
Author

I’m reporting this bug as it could potentially affect others if it’s happening in our case. That’s why I’ve shared the PR—to show that no changes were made to the project between the v14 and v15 upgrade, aside from the version bump. Unfortunately, my team will not have the time to investigate further or create a basic reproduction, as the error message isn’t clear enough to pinpoint its source. I hope this still helps in identifying the issue!

@JesseKoldewijn
Copy link
Contributor

Well reproducibility is kind of a requirement for issues as described in the issue template. So I think this issue might get closed soon😅

@jorrit
Copy link
Contributor

jorrit commented Nov 22, 2024

This happened with me when I tried to do:

import { Head } from 'next/document';

      <Head>
        <title>Title</title>
      </Head>

I was using the app router, so besides the fact that I should have used Head from next/head, I should have used the metadata api instead.

@JesseKoldewijn
Copy link
Contributor

FYI if the only metadata you want to add in this way is the title, you can also run react 19 and just add a title component at a random location. This gets hoisted up into the head now since this react release🤙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Pages Router Related to Pages Router.
Projects
None yet
Development

No branches or pull requests

3 participants