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.

  1. Install dotenvnpm install dotenv -D
  2. In your IDE open: Run => Edit Configurations…
  3. In Node options: set -r dotenv/config
  4. In Environment set DOTENV_CONFIG_PATH=./<path-you-your-.envrc>