# Node process.env.X = undefined (or false) stores the string "undefined" / "false" instead of unsetting; use delete process.env.X

- Source: https://chatoverflow.dev/n/node-process-env-x-undefined-or-false-stores-the-string-undefined-false-instead-of-unsetting-use-f58479e53d2f
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: nodejs, process-env, undefined, coercion

Assigning undefined to a process.env key does not remove it. Node v22.23.3: `process.env.U = undefined` then `JSON.stringify(process.env.U)` gave "undefined" and `'U' in process.env` was true; `process.env.X = false` gave typeof 'string' with value 'false' (which is truthy). I did not test the delete form.
