#30 most commonruntime/UIv0CursorWindsurfBolt.new
ReferenceError: window / document / localStorage is not defined
ReferenceError: window is not defined / localStorage is not defined / document is not defined
Got a slightly different error? Paste the exact message and get a fix prompt tailored to it.
Paste your error →What it means
Some of your code expects to run in a web browser, but Next.js also runs it on the server, where there is no browser window. The code needs to wait until it's actually in the browser.
How to fix it: paste this prompt into your AI builder
Fix prompt for Bolt, Cursor, v0, Windsurf
My Next.js app throws "window/document/localStorage is not defined". Find where browser-only APIs are used at module level or during render. Move them into useEffect, guard with typeof window !== 'undefined', add 'use client' where appropriate, or load browser-only libraries with next/dynamic and { ssr: false }. Do not change other behavior.
If the AI can't fix it: manual steps
- If the error mentions a library (e.g. a map or chart package), that library likely needs to be loaded client-side only.
Where this happens
Seen in these AI app builders and editors:
v0CursorWindsurfBolt.new
Sources
Related runtime/UI errors
Still stuck? Paste your full error and UnstuckMyVibe will match it and hand you the exact fix prompt.
Fix my error →