DEV Community

Cover image for Hydration error while installing NextJS 15
Md Shykat
Md Shykat

Posted on • Edited on

3

Hydration error while installing NextJS 15

After creating a new next 15 project and running the server

npm run dev
Enter fullscreen mode Exit fullscreen mode

if you see these error in your development server:

Image description

Image description

Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used

  • A server/client branch if (typeof window !== 'undefined').
  • Variable input such as Date.now() or Math.random() which changes each time it's called.
  • Date formatting in a user's locale which doesn't match the server.
  • External changing data without sending a snapshot of it along with the HTML.
  • Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

Here is the solve

use this suppressHydrationWarning attribute in your layout.tsx file

return (
    <html lang='en' suppressHydrationWarning>
Enter fullscreen mode Exit fullscreen mode

if this doesn't solve your problem, then So far these are the mentioned extensions that cause hydration errors I have seen here. You guys can add up further names to gather them in a single place to help other fellow devs:

1 - ColorZilla

2 - Wappalyzer

3 - Urban VPN

4 - LastPass

5 - Hacker Vision

6 - WhatFont

7 - Video Speed Controller for HTML videos

8 - Glot

9 - AI Grammar Checker & Paraphraser – LanguageTool

10 - Grammarly

11 - Invert

12 - Dashlane

Happy Coding :)

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (2)

Collapse
 
dejan_solea_29f49a53b8ba profile image
Dejan Soleša

Extension McAffe WebAdvisor causes hydration problems too

Collapse
 
_35140ae18ffa329f8427d profile image
郑耿林

I use the latest next.js, and run in dev mode, but the error also appear!

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay