Next.js Discord

Discord Forum

Error: <Html> should not be imported outside of pages/_document

Unanswered
Forest yellowjacket posted this in #help-forum
Open in Discord
Forest yellowjacketOP
Hi I got an error during build like this:

Error: <Html> should not be imported outside of pages/_document.
Read more: https://nextjs.org/docs/messages/no-document-import-in-page
    at y (.next/server/chunks/7627.js:6:1263)

Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error: <Html> should not be imported outside of pages/_document.
Read more: https://nextjs.org/docs/messages/no-document-import-in-page
    at Y (/project/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js:16:5469)
    at y (/project/.next/server/chunks/7627.js:6:1263)


can someone help me? This error occurs after upgrade to 15.1.6. I am using AppRouter and I don't use <Html> nowhere. With build I set NODE_ENV=production

1 Reply

Forest yellowjacketOP
Solved! I realise that I have NODE_ENV=development in my Docker-compose file and It replace my NODE_ENV production in Dockerfile...