Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

435
Views
Nextjs - importing next/document outside of pages/_document error

I am getting this error during build time because of Next.js custom document.

So, during the build time I am getting an error saying, Also I have the _document.js in pages/_document.js.

next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.

enter image description here

Please help me!

EDIT

Update next and eslint-config-next to version 11.1.3-canary.7

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

This is a known issue from the latest Nextjs update

Quote from Nextjs team:

This is fixed in #28745 and works in 11.1.3-canary.7. Please upgrade to that version if you're experiencing this issue and if you're still seeing the same error, make sure to clear your cache (next lint --no-cache).


Conclude:

You need to update Nextjs and eslint-config-next to 11.1.3-canary.7 and don't forget to clear cache next lint --no-cache

over 4 years ago · Santiago Trujillo Report

0

A known issue that is fixed in #28596

If you don't want to update to the canary versions and still keep working normally just exclude it from your .eslintrc.json rules:

"rules": {
    "@next/next/no-document-import-in-page": "off"
}

More info on how to exclude rules here: disabling-rules

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!