---
title: "dotenv 18 Breaking Changes: Upgrading from 17 | Since.dev"
description: "dotenv 18 drops .env.vault, dotenv_config_ arguments and three exports, logs to stderr, and adds a dotenv binary that clashes with dotenv-cli. Tested."
canonical_url: https://since.dev/guides/dotenv-18-breaking-changes
last_updated: 2026-11-30
---

# dotenv 18 breaking changes: what to fix when you upgrade from 17

dotenv 18.0.0 (September 17, 2026) removes .env.vault decryption, the dotenv_config\_\* command-line arguments and the decrypt export, sends its log line to stderr, and ships a dotenv binary that takes over dotenv-cli's command. config(), parse() and node -r dotenv/config still work.

Updated November 30, 2026

## What changed in dotenv 18?

Five things can break, and three of them give you no error at all. Your `require('dotenv').config()` call still loads `.env` the same way. What changed is everything around it. The [dotenv changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) lists 18.0.0 as: a new CLI, an opt-in fast parser, the log message moved to stderr with tips removed, and five removals (tips, skill files, the Spanish README, `.env.vault` support and preloading).

I ran each case on dotenv 17.4.2 and 18.0.10 with Node.js 24.21.0 on November 30, 2026. Here's what actually differs:

dotenv 17.4.2 vs 18.0.10, tested November 30, 2026 on Node.js 24.21.0, against the dotenv CHANGELOG.md

| Behavior                               | dotenv 17.4.2               | dotenv 18.0.10                            |
| -------------------------------------- | --------------------------- | ----------------------------------------- |
| node -r dotenv/config app.js           | Works                       | Works                                     |
| dotenv_config_path=.env.local argument | Loads .env.local            | Ignored, loads .env, no warning           |
| .env.vault with DOTENV_KEY             | Decrypts the vault          | Ignored, loads .env, no warning           |
| The "injected env" log line            | stdout, with a rotating tip | stderr, no tip                            |
| decrypt, \_configVault, \_parseVault   | Exported                    | Removed (undefined)                       |
| dotenv/lib/\* deep imports             | Exported                    | ERR_PACKAGE_PATH_NOT_EXPORTED             |
| dotenv binary                          | None                        | dotenv run                                |
| DOTENV_PATH and other DOTENV\_\*       | Not read                    | DOTENV_CONFIG\_\* still read as fallbacks |

Upgrade straight to the latest 18.0.x, not 18.0.0. Per the changelog, the ten patch releases after it fixed real problems: 18.0.4 made `dotenv/config` quiet by default again (on 18.0.0 my preload printed `◇ injected env (1) from .env` on every start), 18.0.5 restored a missing TypeScript module declaration, and 18.0.10 (November 8, 2026, per the changelog) fixed `dotenv.parse` in Vite.

## Does node -r dotenv/config still work in dotenv 18?

Yes. The preload itself still runs, despite the "Remove preloading" line in the changelog. What's gone is the way you passed it options: the `dotenv_config_path=`, `dotenv_config_override=` and other `dotenv_config_*` arguments after your script name. dotenv 17 read them from `process.argv` in `lib/cli-options.js`, and that file doesn't exist in 18. Your app starts, finds no error, and reads the wrong file.

Same command, same folder, with HELLO=World in .env and HELLO=Local in .env.local:

```
# dotenv 17.4.2
$ node -r dotenv/config index.js \
    dotenv_config_path=.env.local
Hello Local

# dotenv 18.0.10
$ node -r dotenv/config index.js \
    dotenv_config_path=.env.local
Hello World
```

The fix is to pass the option as an environment variable instead. dotenv 18 reads `DOTENV_PATH`, `DOTENV_QUIET`, `DOTENV_OVERRIDE`, `DOTENV_ENCODING`, `DOTENV_DEBUG` and `DOTENV_FAST`, and per the [dotenv README](https://github.com/motdotla/dotenv#readme) the older `DOTENV_CONFIG_*` names still work as fallbacks. If you want one script that runs on both 17 and 18, use the old name, because 17 ignores `DOTENV_PATH`:

```
# dotenv 18.0.10
$ DOTENV_PATH=.env.local \
    node -r dotenv/config index.js
Hello Local

# dotenv 17.4.2
$ DOTENV_PATH=.env.local \
    node -r dotenv/config index.js
Hello World

# both versions
$ DOTENV_CONFIG_PATH=.env.local \
    node -r dotenv/config index.js
Hello Local
```

The maintainer's own advice in the [Dotenv 18 announcement](https://dotenvx.com/blog/2026/09/19/dotenv-18.html) is to switch preloads to the new CLI, `dotenv run -- node index.js`. I'd do that for new scripts. For existing ones, the environment variable is the one-line fix, and it's the smaller diff to review.

## Why did my .env.vault stop loading after upgrading dotenv?

Because dotenv 18 removed `.env.vault` support entirely, and it doesn't tell you. With `DOTENV_KEY` set, dotenv 17 decrypted the matching `DOTENV_VAULT_<ENVIRONMENT>` entry. dotenv 18 ignores both the key and the vault and loads plain `.env` if there is one. In production, where there usually isn't, your variables are simply missing.

I built a test vault with a random key in the format dotenv 17's `decrypt()` reads (AES-256-GCM, the nonce first and the auth tag last), holding HELLO=Vault, next to a .env holding HELLO=World. load.js calls `config()` and prints HELLO. v17's tip text is cut:

```
# dotenv 17.4.2
$ DOTENV_KEY="$KEY" node load.js
◇ loading env from encrypted .env.vault
◇ injected env (1) from .env.vault // tip: ...
HELLO=Vault

# dotenv 18.0.10
$ DOTENV_KEY="$KEY" node load.js
◇ injected env (1) from .env
HELLO=World
```

If you still use a vault, you have two choices. Stay on dotenv 17 for now and pin it (`"dotenv": "~17.4.2"` keeps you on 17.4.x; see [caret vs tilde](https://since.dev/guides/caret-vs-tilde-package-json.md)). Or move the secrets out: the announcement points to [dotenvx](https://dotenvx.com/docs) for encrypted .env files, and your platform's own secret store works too. Either way, decide before a dependency bot raises dotenv to 18 for you.

A quick guard that catches this class of failure: check the variables you need right after loading, and exit if one is missing. Then a silent change in how .env gets loaded shows up as a failed start instead of a bug report.

## Why does dotenv-cli break after upgrading dotenv to 18?

Because both packages now install a binary called `dotenv`, and dotenv 18's wins. [dotenv-cli](https://www.npmjs.com/package/dotenv-cli) 11.1.0 (October 28, 2026, per npm) depends on dotenv `^17.1.0`, so when your project also lists dotenv 18 directly, npm puts 18 at the top level and links `node_modules/.bin/dotenv` to its CLI. Every script written as `dotenv -e .env.test -- jest` now runs a different program.

```
$ npm install dotenv-cli@11.1.0 dotenv@18.0.10
$ ls -la node_modules/.bin | grep dotenv
... dotenv -> ../dotenv/dist/cli.cjs
... dotenv-cli -> ../dotenv-cli/cli.js

$ npx dotenv -e .env.local -- node index.js
Usage: dotenv run [--help] [-q|--quiet] ...
$ echo $?
1
```

I've cut the `ls` columns and the usage text, which goes on to list dotenv 18's own options. With dotenv 17.4.2 instead, the same `npx dotenv -e` command printed Hello Local, because 17 has no binary.

dotenv-cli also installs itself as `dotenv-cli`, and that name doesn't clash. Rename the command in your scripts and keep everything else:

```
$ npx dotenv-cli -e .env.local -- node index.js
Hello Local
```

Or drop dotenv-cli and use dotenv 18's own command: `dotenv -e .env.test -- jest` becomes `dotenv run -f .env.test -- jest`. Check the options you rely on first. dotenv-cli also pulls in dotenv-expand for variable expansion, and dotenv 18's `--help` lists no expansion option.

## Where did dotenv's log message go in version 18?

To stderr, without the tip. dotenv 17 wrote `◇ injected env (1) from .env` plus a rotating tip to stdout every time `config()` ran. dotenv 18 writes the same line to stderr and drops the tip. You can see it by silencing one stream at a time:

```
# dotenv 17.4.2: the line is on stdout
$ node load.js 2>/dev/null
◇ injected env (1) from .env // tip: ...
HELLO=World

# dotenv 18.0.10: the line is on stderr
$ node load.js 2>/dev/null
HELLO=World
$ node load.js >/dev/null
◇ injected env (1) from .env
```

Most apps won't care. It matters if a CLI you wrote prints JSON to stdout and something parses it (17's line broke that, so 18 fixes it), or if a test or log pipeline counts on that line being on one stream. To turn it off in either version, pass `config({ quiet: true })`. The `dotenv/config` preload and import are quiet by default from 18.0.4 on; set `DOTENV_QUIET=false` to see the line again.

## Which exports did dotenv 18 remove?

Three functions and every file under `dotenv/lib`. The package's main export went from seven keys to four:

```
# dotenv 17.4.2
$ node -e "console.log(Object.keys(
    require('dotenv')).sort().join(' '))"
_configVault _parseVault config configDotenv
decrypt parse populate

# dotenv 18.0.10
config configDotenv parse populate
```

I've wrapped the command and the 17.4.2 output to fit. Code that destructures `decrypt` gets `undefined` and fails with a TypeError only when it's called, not on import. A deep import such as `require('dotenv/lib/env-options')` fails at once with `ERR_PACKAGE_PATH_NOT_EXPORTED`, because 18's `exports` map only lists `.`, `./config`, `./config.js` and `./package.json`. The code moved from `lib/main.js` to `dist/index.cjs`, which `npm diff --diff=dotenv@17.4.2 --diff=dotenv@18.0.10 --diff-name-only` shows in its file list.

`config()`, `configDotenv()`, `parse()` and `populate()` behave the same in my runs, including a missing file: `config({ path: 'nope.env' })` returns an `ENOENT` error object on both versions instead of throwing.

## How do I upgrade from dotenv 17 to 18 safely?

Search for what 18 changes, fix each hit, then bump. Start in a git repository, from the root:

```
$ P='dotenv_config_|dotenv -e |DOTENV_KEY'
$ P="$P|env\.vault|dotenv/lib|decrypt"
$ git grep -lE "$P"
package.json
src/secrets.js
```

That's the output on a small test repository with one preload script, one dotenv-cli script and one decrypt call. Expect some noise from unrelated words like decrypt; open each file it names. Then:

1. Replace `dotenv_config_path=x` arguments with `DOTENV_CONFIG_PATH=x` in front of the command, or switch the script to `dotenv run -f x -- node app.js`.
2. Rename `dotenv -e` scripts to `dotenv-cli -e`, or move them to `dotenv run -f`.
3. If anything sets `DOTENV_KEY` or ships a `.env.vault`, move those secrets first, or hold dotenv at 17.
4. Remove calls to `decrypt` and imports from `dotenv/lib`.
5. Bump with `npm install dotenv@^18.0.10`, start the app once with `DOTENV_QUIET=false` and check that the injected env line names the file and the count you expect.

dotenv 18 still declares `"node": ">=12"` in its package.json, the same as 17.4.2, so you don't need a Node.js upgrade for it. For the general method behind that search, see [how to find breaking changes between two versions](https://since.dev/guides/breaking-changes-between-versions.md).

## Should I use dotenv run or Node's env-file flag?

Use Node's `--env-file` when you only run Node and want one dependency fewer; use `dotenv run` when the command isn't Node, or you want dotenv's options. Per the [Node.js CLI docs](https://nodejs.org/api/cli.html#--env-filefile), `--env-file` was added in v20.6.0 and stopped being experimental in v24.10.0 and v22.21.0.

```
$ node --env-file=.env index.js
Hello World

$ npx dotenv run -f .env.local -- node index.js
◇ injected env (1) from .env.local
Hello Local
```

The differences that matter: Node exits with `node: nope.env: not found` if the file is missing (`--env-file-if-exists` carries on), while `dotenv run` starts any executable on your PATH, per the [Dotenv 18 announcement](https://dotenvx.com/blog/2026/09/19/dotenv-18.html), so it works for scripts that aren't Node. Both leave a variable you already set alone (`HELLO=Shell node --env-file=.env index.js` printed Hello Shell); `dotenv run --override` lets the file win. In my run, `HELLO=Shell npx dotenv run -- node index.js` printed Hello Shell with `injected env (0)`, and adding `--override` printed Hello World. Check which Node.js lines are still supported on the [Node.js release calendar](https://since.dev/calendar/nodejs.md) before you rely on a flag.

## Where Since.dev fits

Since.dev keeps a [dotenv breaking changes page](https://since.dev/packages/npm/dotenv) that lists every dotenv release that removed or changed something, each with its source, so a line like "Remove preloading" sits next to what it means for your code. For the habit that catches changes like these before you merge a bump, see [checking dependencies for breaking changes before you upgrade](https://since.dev/guides/dependency-breaking-changes.md).

To see what a public repository is exposed to, run a free [scan](https://since.dev/scan.md), or give your coding agent the same answers through the [docs](https://since.dev/docs.md). When a change like dotenv 18's reaches a repository you connect, Since.dev reports where your code is affected and can open a pull request with the fix for you to review. It doesn't open routine version bumps. Nothing merges or deploys on its own.

## Questions

### Is dotenv 18 a breaking change?

Yes, for some projects. config() and parse() work the same, but dotenv 18 removes .env.vault decryption, the dotenv_config\_\* command-line arguments for preloads, the decrypt export and deep imports from dotenv/lib. It also moves its log line to stderr and adds a dotenv binary that replaces dotenv-cli's.

### Does import 'dotenv/config' still work in dotenv 18?

Yes. Both import 'dotenv/config' and node -r dotenv/config still load .env on 18.0.10. From 18.0.4 they are quiet by default. To change the file, set DOTENV_PATH or DOTENV_CONFIG_PATH in the environment, since dotenv_config_path= arguments are ignored.

### Why is dotenv_config_path ignored after upgrading to dotenv 18?

dotenv 18 deleted the code that read dotenv_config\_\* arguments from the command line. The preload still runs but falls back to .env with no warning. Use DOTENV_CONFIG_PATH=.env.local node -r dotenv/config app.js, which works on both 17 and 18.

### What replaced .env.vault in dotenv 18?

Nothing inside dotenv. Version 18 removed .env.vault support, and the maintainer's announcement points to dotenvx for encrypted .env files. Until you move the secrets, keep dotenv on 17 with a range like \~17.4.2.

### Why does my dotenv -e command print Usage: dotenv run after upgrading?

Because dotenv 18 installs its own dotenv binary, and npm links it ahead of the one from dotenv-cli, which still depends on dotenv 17. Call dotenv-cli -e instead of dotenv -e, or rewrite the script to use dotenv run -f with your .env file.

### Do I need a newer Node.js for dotenv 18?

No. dotenv 18.0.10 declares Node.js 12 or later in the engines field of its package.json, the same as 17.4.2. If you'd rather drop the package, Node's own env-file flag has been in Node.js since v20.6.0.

## Related guides

### How-to

- [How to find the breaking changes between two versions of a package](https://since.dev/guides/breaking-changes-between-versions.md)How to find breaking changes between two versions of a package: list the releases in between, read each changelog, diff the code. Commands for npm, PyPI, Go.
- [How to check your dependencies for breaking changes before you upgrade](https://since.dev/guides/dependency-breaking-changes.md)How to check dependencies for breaking changes before upgrading: the commands, a real failing upgrade, CI that fails on deprecations, and where notices appear.
- [boto3 1.44.0 breaking changes: the new retry default, tested](https://since.dev/guides/boto3-1-44-breaking-changes.md)boto3 1.44.0 makes standard retries the default: 3 attempts instead of 5, much shorter waits, and bearer tokens need HTTPS. Tested on both versions.

### Explainers

- [Caret vs tilde in package.json: what ^ and \~ let in](https://since.dev/guides/caret-vs-tilde-package-json.md)Caret (^) allows minor and patch updates, tilde (\~) only patches. The 0.x exception, what your lockfile does, and how ^ and \~ differ in Cargo and Composer.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
