Get ready to launch yourself on kawigraphics.com
Join thousands of United States businesses already using our hosting services—everything you need to build a fast, reliable website that serves United States customers perfectly.
See our plansdirenv
?direnv
is a shell extension that automatically loads or unloads environment variables based on the directory you're in. Think of it as dotenv
on steroids — it not only loads .env
files, but also runs shell scripts, manages Node versions via .nvmrc
, and more.
Key Features
.envrc
files automatically when entering a directory.nvmrc
and .node-version
to auto-switch Node.js versionsnvm install
direnv
+ nvm
direnv
direnv
into Your ShellYou need to add the following line to your shell's configuration file to enable direnv
.
zsh
:bash
:Then apply the changes:
.envrc
Navigate to the root of your Node.js project:
This tells direnv
to look for a .nvmrc
file and load the specified Node version.
Now authorize direnv
to load the .envrc
:
If you have a .nvmrc
file (e.g. v20.12.2
), direnv
will:
nvm install
(if the version isn't installed yet)nvm use
when you enter the directoryuse_nvm
WorksThe use_nvm
directive is a built-in direnv
helper that does all the heavy lifting. Internally, it functions like this:
You can even customize it further by placing a modified version in:
.env
and .nvmrc
in .envrc
Want to load environment variables too? Update your .envrc
:
Or declare environment variables directly:
.nvmrc
and .envrc
.env
(if it contains secrets)Update your .gitignore
:
Using direnv
with nvm
is a game-changer for managing Node.js versions and environment variables per project. It reduces human error, ensures consistency across teams, and simplifies onboarding and deployment processes.
Whether you're building a startup or managing an enterprise-grade Node.js project, we offer consulting, automation, and environment setup services tailored to your stack.
Contact us today to streamline your workflow and focus on what you do best — building amazing software.
Join thousands of United States businesses already using our hosting services—everything you need to build a fast, reliable website that serves United States customers perfectly.
See our plansThis ultimate guide provides knowledge to make informed decisions, helping your website operate efficiently, securely, and smoothly
A major threat businesses face is typosquatting—deceptive domains tricking users, stealing trust, and damaging brand reputations
Cybercrime is increasing, with attackers often exploiting weakly protected accounts as the easiest entry point to systems