Catch .env drift before it breaks a deploy.
env-look compares your .env against .env.example and tells you exactly what's out of sync — missing keys, stray keys nobody documented, empty values, and duplicate definitions. Zero dependencies, works in any Node project regardless of framework.
Someone adds a new required env var, forgets to update .env.example, and three days later a teammate's local setup — or worse, a CI pipeline — breaks with a cryptic error, five layers away from the actual missing variable. env-look catches this in one command, and can gate CI so it never reaches production.
npm install -g env-lookOr run it without installing:
npx env-look checkenv-look checkenv-look checking .env against .env.example
✖ Missing (1) - in .env.example but not .env:
- DB_PORT
⚠ Extra (1) - in .env but not .env.example:
- EXTRA_LEGACY_VAR
⚠ Empty values (1):
- API_KEY
Options:
| Flag | Description | Default |
|---|---|---|
--env <file> |
path to the env file to check | .env |
--example <file> |
path to the example file | .env.example |
--strict |
exit with code 1 if any issue is found |
off |
--json |
print a machine-readable report instead | off |
env-look initKeeps every key, comment, and blank line from your .env, strips every real value, so nothing secret ends up in the file you commit.
Options: --env <file>, --out <file>, --force (overwrite if the output already exists).
# GitHub Actions example
- name: Check env vars are in sync
run: npx env-look check --strictThis fails the build the moment .env.example and the actual required config drift apart, instead of failing later at deploy time with a much less obvious error.
- Missing — keys documented in
.env.examplebut absent from.env - Extra — keys in
.envthat aren't documented in.env.example(often dead config nobody cleaned up) - Empty — keys present but with no value set
- Duplicates — the same key defined more than once in
.env(the last one silently wins, which is a common source of confusing bugs)
A tool that reads your environment configuration is a reasonable thing to be careful about. env-look ships with no runtime dependencies at all — nothing to audit beyond this repo's own code.
Issues and PRs welcome. Run the test suite with:
npm testMIT