Socket
Book a DemoInstallSign in
Socket

env-cmd

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-cmd

Executes a command using the environment variables in an env file

11.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1.2M
-2.67%
Maintainers
2
Weekly downloads
 
Created

What is env-cmd?

The env-cmd npm package allows you to easily set environment variables from a file or inline before running a command. This is particularly useful for managing different environments (development, testing, production) without hardcoding environment variables in your code.

What are env-cmd's main functionalities?

Load environment variables from a file

This feature allows you to load environment variables from a specified file before running your command. The file should follow the standard .env format.

env-cmd -f ./path/to/.env node app.js

Load environment variables from multiple files

You can load environment variables from multiple files. This is useful for layering configurations, such as having a base configuration and an environment-specific override.

env-cmd -f ./path/to/.env -f ./path/to/.env.local node app.js

Inline environment variables

This feature allows you to set environment variables inline directly in the command. This is useful for quick tests or temporary overrides.

env-cmd -e 'NODE_ENV=production' node app.js

JSON configuration

You can also pass environment variables as a JSON object. This is useful for more complex configurations that might be easier to manage in JSON format.

env-cmd -e '{"NODE_ENV": "production", "API_KEY": "12345"}' node app.js

Other packages similar to env-cmd

Keywords

env

FAQs

Package last updated on 23 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.