Description
I was having a problem where direnv
failed loading the Nix shell due to an invalid NODE_OPTIONS
flag, but only in the VS Code integrated terminal. Outside of VS Code direnv
had no issue loading and NODE_OPTIONS
was unset. I wasn't setting NODE_OPTIONS
anywhere, such as .envrc
or .env
. Eventually I found reference to NODE_OPTIONS
in ~/.config/Code/User/workspaceStorage/33633d8607204d6980a785c25990590d/state.vscdb.backup
. It's an SQLite DB, and in the ItemTable
table there's a row with key terminal.integrated.environmentVariableCollections
where the value is a JSON blob and that shows the environment variable is from mkhl.direnv
. Knowing that, I ran direnv: Reset and reload environment
, which got rid of the NODE_OPTIONS
environment variable.
It seems like somehow the direnv VS Code extension isn't properly updating the direnv environment in the integrated terminal. I had set that environment variable like 3 weeks ago to test something and then remove it and I've definitely rebooted my computer, reloaded VS Code, exited VS Code, exited the integrated terminal (typing exit
to clear history), etc. I assumed re-opening VS Code would reload the environment properly.
What's interesting is that I find no logging of the direnv extension setting NODE_OPTIONS
in the VS Code logs. rg --no-ignore NODE_OPTIONS -l ~/.config/Code/logs
returns zero direnv
results.