How to fix "File '.../node_modules/dotenv/types' not found." error coming from jsconfig.json?

Steve picture Steve · Jul 28, 2020 · Viewed 7.7k times · Source

VSCode is showing errors for jsconfig.json: "File '.../node_modules/dotenv/types' not found."

Appears to be looking for typescript definitions for dotenv, but I'm not using typescript or dotenv (other than in imported packages). And there is a node_modules/dotenv/types folder.

Answer

Anoesj Sadraee picture Anoesj Sadraee · Aug 10, 2020

I had the same issue. Restarting VSCode solved the problem. See: https://github.com/motdotla/dotenv/issues/475

Edit: this seems to be an issue with the contents of dotenv's package.json. There's an open PR, but the author hasn't replied/merged yet at this time. Link: https://github.com/motdotla/dotenv/pull/476

Edit 2: This should now be fixed! dotenv v8.4.0 fixes this issue. See https://github.com/motdotla/dotenv/releases/tag/v8.4.0.