The Prompt BakeryTemplates and prompts

Fix · Pages, phones and Arabic

"window is not defined" or "localStorage is not defined"

What you may see

  • The page crashes on the server or at build time

Most likely cause

Server code has no browser, so browser-only names do not exist while the page is drawn on the server.

Check first (about two minutes)

  1. Find the file and line in the stack.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Move the browser-only code into an effect (after loading), or into a client-only component, or guard it with a check that the name exists.
  2. If a package needs the browser, load it only on the client.

Do not do this

  • Do not define fake window objects on the server.
  • Do not switch the whole page to client-only for one line.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.