Built Next.js app suddenly disappears after loading for a moment, but runs fine in development environment
P粉668113768
P粉668113768 2023-08-15 15:51:16
0
1
425

My next.js project using typescript runs fine in the development environment, but when building npm run build the page disappears after loading. I think this has something to do with laying out the page, but I'm not sure. I got the following information in the console.

Uncaught Error: Minified React Error #418; visit https://reactjs.org/docs/error-decoder.html?invariant=418 for the full message, or at the full error and other helpful warnings used in a non-minified development environment. Uncaught Error: Minified React Error #423; visit https://reactjs.org/docs/error-decoder.html?invariant=423 for the full message, or for non-minified development the full error and other helpful warnings environment. DOMException: Execution of 'appendChild' on 'Node' failed: Only one element is allowed on the document. DOMException: 'removeChild' on 'Node' failed: 'The node to be removed is not a child of this node.'

layout.tsx

import './globals.css' import type { Metadata } from 'next' // import { Inter } from 'next/font/google' import Navbar from '../components/Navbar' import Image from 'next/image' // const inter = Inter({ subsets: ['latin'] }) export const metadata: Metadata = { title: 'redacted', description: 'Personal website', } export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( 
{''}
{children}
) }

I tried editing the {children} component but nothing seems to work.

P粉668113768
P粉668113768

reply all (1)
P粉416996828

Have you tried using theReact.ReactNode[]type to input children?

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!