Compare .env against .env.example and catch missing, empty, or extra environment variables — before they break your build.
Every team has that moment: someone adds a new required env var, forgets to tell anyone, and a teammate's app silently breaks (or worse, deploys with a missing secret). env-diff-now catches this in seconds.
npm install --save-dev env-diff-nowOr run without installing:
npx env-diff-nowenv-diff-now✖ Missing (2):
- DATABASE_URL
- STRIPE_SECRET_KEY
⚠ Empty (1):
- API_TIMEOUT
ℹ Extra — present in .env but not in .env.example (1):
- DEBUG_MODE
| Flag | Description | Default |
|---|---|---|
--env <path> |
Path to actual env file | .env |
--example <path> |
Path to example env file | .env.example |
--strict |
Also fail (exit 1) on empty vars, not just missing | false |
--quiet, -q |
Only print output when there's a problem | false |
--help, -h |
Show help | |
--version, -v |
Show version |
0— all good1— missing (or empty, with--strict) variables found2—.env.examplefile not found
# .github/workflows/ci.yml
- name: Check env vars
run: npx env-diff-now --strict{
"scripts": {
"postinstall": "env-diff-now --quiet || echo 'Check your .env file — see above'"
}
}Tip:
postinstallruns even without a.envpresent on fresh clones —env-diff-nowhandles that gracefully and just reports every example var as missing, guiding new contributors to set things up correctly.
MIT