admin管理员组

文章数量:1389951

I’m having an issue with VS Code in a react project. My environment variables from the terminal take precedence over the .env files.

I have multiple environments (production/debug), and my .env files are supposed to define the correct environment. However, even when I specify that the project should run in debug mode, it keeps using the environment variables set in the terminal (from printenv).

The problem is that for any reason the production env var are set in the workspace terminal and I cannot clear them because when I restart terminal the variables will be present again. And this has nothing to do with my project config, since even if I completely delete my env files from my project, when restarting my terminal the variables will be present again..

The only workaround I found is to delete the workspace and clone the project again using git clone, which is not ideal.

And these variables don't come from my deamon Mac terminal either, since they're not present there. It's only at the level of my vscode workspace, as if there were some sort of vscode configuration.

So if you have a solution, I'd love to hear it.

For more information I'm on Mac and I using dotenv to set my environment variable

本文标签: macosVSCode terminal env variable hardcoded can39t be removedStack Overflow