Next.js Discord

Discord Forum

Anyone know how to fix this or know about it?

Answered
Red-billed Tropicbird posted this in #help-forum
Open in Discord
Red-billed TropicbirdOP
NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Answered by Spectacled bear
Remove <html> and body tag from this layout
View full answer

9 Replies

Red-billed TropicbirdOP
Here is the file I think causing it


import type { Metadata } from "next"
import { Ubuntu } from "next/font/google"

const ubuntu = Ubuntu({
  weight: ["300", "400", "500", "700"],
  subsets: ["latin"],
})

interface ResumeLayoutProps {
  children: React.ReactNode
}

export default function ResumeLayout({
  children,
}: ResumeLayoutProps): JSX.Element {
  return (
    <html lang="en" className="antialiased">
      <body>{children}</body>
    </html>
  )
}
Barbary Lion
you should use the Head component from next/head to manage the document head and the _document.js file to modify the <html> and <body> tags. You typically shouldn't render html or body tags directly in a component. Instead, you should use _document.js for these elements.

This may potentially be causing your issue.
Red-billed TropicbirdOP
How doul that look?
would
Red-billed TropicbirdOP
This is a layout for a nested route.
Red-billed TropicbirdOP
Is there something wrong or a reason this error may have occured?
@Red-billed Tropicbird Is there something wrong or a reason this error may have occured?
Spectacled bear
Remove <html> and body tag from this layout
Answer
Spectacled bear
like this:
export default function ResumeLayout({
children,
}: ResumeLayoutProps): JSX.Element {
return (
<div className="antialiased">
{children}
</div>
)
}