Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@ethanresnick/node-env-run
Advanced tools
Wrapper executable to load env variables from .env and run Node
Command-line tool to read
.env
files and execute scripts/commands after loading those environment variables
dotenv
under the hoodI recommend installing this module as a devDependency
for the respective project.
Install via yarn
:
yarn add node-env-run --dev
Install via npm
:
npm install node-env-run --save-dev
You can alternatively install the module globally if you want to:
npm install node-env-run --global
Add a new scripts entry to your package.json
. Example:
{
"scripts": {
"dev": "nodenv .",
"test": "nodenv -E test/.env test/test.js"
}
}
Or use it with npx
:
npx node-env-run .
This module uses under the hood the dotenv
module to parse the .env
file. For more information about how to structure your .env
file, please refer to its documentation.
Start up the main
file in package.json
with the enviornment variables from .env
:
nodenv .
Start Node.js REPL with set environment variables from .env.repl
:
nodenv -E .env.repl
Run Python file with overridden environment variables:
nodenv app.py --exec python --force
Run server.js
file using nodemon
:
nodenv server.js --exec nodemon
Pass --inspect
flag for debugging after --
:
nodenv someScript -- --inspect
You can pass node-env-run
a variety of arguments. These are the currently supported arguments:
Flag | Type | Description |
---|---|---|
--encoding | string | Lets you specify the encoding of the .env file. Defaults to utf8 encoding. |
--env or -E | string | Specifies the path to the .env file that should be read |
--exec or -e | string | This lets you specify a command other than node to execute the script with. More in the next section. |
--force or -f | boolean | Flag to temporarily override existing environment variables with the ones in the .env file |
--help | boolean | Displays the usage/help instructions |
--verbose | boolean | Flag to enable more verbose logging |
--version | boolean | Displays the current version of the package |
node-env-run
with other executablesYou can use node-env-run
with other executables. This is particularly useful if you try to combine it with things like babel-node
or ts-node
:
nodenv index.ts --exec "ts-node"
However, you can also use it with completely unrelated executables such as python:
nodenv app.py --exec python
Dominik Kundel 💻 |
---|
MIT
FAQs
Wrapper executable to load env variables from .env and run Node
The npm package @ethanresnick/node-env-run receives a total of 0 weekly downloads. As such, @ethanresnick/node-env-run popularity was classified as not popular.
We found that @ethanresnick/node-env-run demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.