Fix · Node, npm and build
process.env.X is undefined (my .env value is not read)
What you may see
- A value from my .env file is undefined in the app
- It is undefined only in the browser
Most likely cause
The file name or variable name is not what the tool reads, the dev server was not restarted, or browser code needs the public prefix.
Check first (about two minutes)
- Is the file in the project root (next to package.json) and named exactly as the tool expects?
- Did you stop and start the dev server after editing it?
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
- Show the file NAMES (not contents) in the root, and the variable names the code reads.
- Explain the prefix rule of this framework for browser code and for server code, and fix the names.
- Tell me to restart the dev server; check that .env is listed in .gitignore.
Do not do this
- Do not commit .env.
- Do not print real secret values.
- Do not give a secret a public prefix.