{"id":16982,"library":"dotenv-flow-cli","title":"dotenv-flow CLI","description":"dotenv-flow-cli is a command-line interface (CLI) tool designed to execute shell commands with environment variables loaded from `.env` files using `dotenv-flow`'s sophisticated loading logic. It automatically processes different `.env` files based on the `NODE_ENV` and other `dotenv-flow` conventions, allowing for environment-specific configurations (e.g., `.env.development`, `.env.production`, `.env.local`). The current stable version is 1.1.1, with the last publish date over two years ago, suggesting a maintenance or stable cadence driven by its upstream dependencies, `dotenv-flow` and `dotenv-expand`. Its key differentiator from `dotenv-cli` is the reliance on `dotenv-flow`'s specific cascading `.env` file loading strategy, which includes support for `development`, `test`, `production`, and `.local` overrides, along with automatic variable expansion. It is intended as a direct wrapper, providing a convenient executable for managing environment variables for CLI commands.","status":"maintenance","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/ovos/dotenv-flow-cli","tags":["javascript"],"install":[{"cmd":"npm install dotenv-flow-cli","lang":"bash","label":"npm"},{"cmd":"yarn add dotenv-flow-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add dotenv-flow-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the core logic for loading environment variables from cascading .env files.","package":"dotenv-flow","optional":false},{"reason":"Enables variable expansion (interpolation) within .env files, allowing variables to reference each other.","package":"dotenv-expand","optional":false}],"imports":[{"note":"Primary usage is via direct shell command invocation in `package.json` scripts or terminal.","wrong":null,"symbol":"dotenv-flow CLI execution","correct":"dotenv-flow <command> [args...]"},{"note":"Use the `-p` or `--path` option to specify an alternative directory where `.env*` files are located.","wrong":null,"symbol":"dotenv-flow with custom path","correct":"dotenv-flow -p path/to/project <command> [args...]"},{"note":"Always use the `--` separator before the command if the command itself takes arguments, to prevent `dotenv-flow-cli` from misinterpreting them.","wrong":"dotenv-flow <command> <command-arguments...>","symbol":"dotenv-flow with command arguments","correct":"dotenv-flow -- <command> <command-arguments...>"}],"quickstart":{"code":"npm install -g dotenv-flow-cli\n\n# Create example .env files\necho \"APP_NAME=MyFlowApp\" > .env\necho \"API_KEY=dev_123\" > .env.development\necho \"API_KEY=prod_xyz\" > .env.production\necho \"DEBUG_MODE=true\" > .env.development.local\n\n# Run a command in development environment\nNODE_ENV=development dotenv-flow -- node -e \"console.log('App Name:', process.env.APP_NAME); console.log('API Key:', process.env.API_KEY); console.log('Debug Mode:', process.env.DEBUG_MODE);\"\n\n# Run a command in production environment\nNODE_ENV=production dotenv-flow -- node -e \"console.log('App Name:', process.env.APP_NAME); console.log('API Key:', process.env.API_KEY); console.log('Debug Mode:', process.env.DEBUG_MODE);\"\n","lang":"bash","description":"Demonstrates global installation, creation of layered `.env` files, and executing Node.js commands to show how `dotenv-flow-cli` loads environment variables based on `NODE_ENV` and `.local` overrides."},"warnings":[{"fix":"Always use the `--` separator before the actual command if it takes additional arguments (e.g., `dotenv-flow -- my-command -p something`).","message":"Arguments intended for the underlying command may be parsed by `dotenv-flow-cli` instead, leading to unexpected behavior or lost arguments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Refer to the comprehensive `dotenv-flow` documentation to understand the exact file loading precedence and override rules.","message":"Misunderstanding `dotenv-flow`'s specific file loading order (e.g., `.env.development.local` overrides `.env.development`, which overrides `.env`) can lead to environment variables not being what's expected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware that variables like `APP_URL=http://${IP}:${PORT}` will automatically resolve. If this behavior is undesired, ensure variables are properly escaped or consider alternative tools.","message":"Variable expansion (interpolation) is automatically enabled using `dotenv-expand` under the hood. This can be unexpected if users are accustomed to `dotenv-cli` without explicit expansion.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"While functional, major updates or compatibility with newer Node.js versions or dependency changes might be slow. Consider pinning specific versions of underlying dependencies like `dotenv-flow` if stability is critical.","message":"The package `dotenv-flow-cli` itself has not been updated in over two years (last published January 7, 2024), indicating a stable but potentially unmaintained state.","severity":"gotcha","affected_versions":"<=1.1.1"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Install globally using `npm install -g dotenv-flow-cli` or `yarn global add dotenv-flow-cli`. Alternatively, use `npx dotenv-flow <command>` for ad-hoc execution without global installation.","cause":"`dotenv-flow-cli` is not installed globally or is not in the system's PATH.","error":"command not found: dotenv-flow"},{"fix":"Verify `.env` filenames adhere to `dotenv-flow` conventions (e.g., `.env`, `.env.development`, `.env.production`, `.env.local`). Ensure `NODE_ENV` is correctly set before running the `dotenv-flow` command, or use the `-p` option to specify the correct directory.","cause":"Incorrect `.env` file naming convention, `NODE_ENV` not matching, or files are not located in the current working directory or the specified path.","error":"Environment variable 'MY_VAR' is not set, but I defined it in .env"}],"ecosystem":"npm","meta_description":null}