question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

next/head crashes app

See original GitHub issue

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

next info

    Operating System:
      Platform: linux
      Arch: x64
      Version: Ubuntu 20.04.0 LTS Wed Oct 26 2022 00:51:29 GMT-0300 (Horário Padrão de Brasília)
    Binaries:
      Node: 16.14.2
      npm: 7.17.0
      Yarn: 1.22.19
      pnpm: 7.13.6
    Relevant packages:
      next: 12.3.2-canary.43
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

firefox

How are you deploying your application? (if relevant)

next dev

Describe the Bug

When using the Head component, this error is thrown in the console:

TypeError: Cannot read property '' of undefined
    at resolveModuleReference (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:46:58)
    at resolveModule (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:646:25)
    at processFullRow (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:735:9)
    at processBinaryChunk (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:789:5)
    at progress (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:842:5)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Expected Behavior

To work properly without any errors

Link to reproduction

https://stackblitz.com/edit/vercel-next-js-vjs4ah?file=src/app/layout.tsx

To Reproduce

Create a root layout in app folder that adds a Head component

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JeroenReumkenscommented, Oct 26, 2022

@darklight9811 After some digging around I noticed that the new way to use this is creating a head.tsx file next to the page: https://beta.nextjs.org/docs/routing/pages-and-layouts#modifying-head

Not fully sure what I think about it yet though 😅 It’s nice… But having these extra files is also not? 😬

0reactions
github-actions[bot]commented, Nov 28, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the Next.js Head component outside of _document ...
It turns out that when using heads outside the document definition, you need to import them from "next/head" instead of "next/document" . Share....
Read more >
Why this nextjs code is crashing ? - YouTube
hiteshChoudhary.com Download LearnCodeOnline.in app from Google play store and Apple App store https://play.google.com/store/ apps /de.
Read more >
Advanced Features: Error Handling - Next.js
Handle errors in your Next.js app. ... In addition to preventing the page from crashing, it allows you to provide a custom fallback...
Read more >
A 2021 Crash Course in Next.js
A 2021 Crash Course in Next.js · Server-Side Rendering Unlike a traditional React app where the entire application is loaded and rendered on...
Read more >
How To Fix Android Messages Keeps Crashing - The Droid Guy
If the Android Messages app keeps stopping or crashing and you have no ... Next, head over to your device's Settings > System...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found