Quick answer

Each non-empty line in a .env file must be either a comment (starting with #) or a KEY=value pair.

.env Invalid Line

Each non-empty line in a .env file must be either a comment (starting with #) or a KEY=value pair. Missing =, invalid key characters, or malformed lines cause validation errors.

Common causes

How to fix

Examples

Bad

NODE ENV=production

Good

NODE_ENV=production

FAQ

Can .env keys have spaces?
No. Keys must start with a letter or underscore and contain only letters, digits, and underscores.
What if my value contains =?
The first = separates key from value; the rest is part of the value.

Fix it now

Try in validator (prefill this example)

Related

All tools · Canonical