Jetbrains x direnv
Sun, Jan 22, 2023
When working with node and using direnv for setting environment variables, the variables are only available in a shell.
Since Jetbrains IDEs built in run/debug functionalities are not affected by direnv, the .envrc
file must be included separately via run configuration. This requires the dotenv package.
- Install dotenv
npm install dotenv -D
- In your IDE open: Run => Edit Configurations…
- In
Node options:
set-r dotenv/config
- In
Environment
setDOTENV_CONFIG_PATH=./<path-you-your-.envrc>