35

Why is VSCode showing this error?

It's just a jsconfig.json file.

NOTE: I'm not using TypeScript.

enter image description here

cbdeveloper
  • 27,898
  • 37
  • 155
  • 336

5 Answers5

63

Try adding "exclude": ["node_modules"] as described in the VSCode docs.

I added this and restarted VSCode and the error message went away.

Thomas Wang
  • 2,233
  • 2
  • 14
  • 24
  • 15
    This worked. Restarting VSCode is very important in this case. – Kay_S Mar 03 '21 at 02:47
  • 7
    I had to include a slash for it work "node_modules/" – Titan May 14 '21 at 14:07
  • 2
    It's enough to restart the TS Server instead of restarting VS Code. Open the command palette and search for: `TypeScript: Restart TS Server`. – ccssmnn Dec 22 '21 at 07:59
  • This doesn't work for me. Even including a slash like other users have suggested still doesn't work. And I properly restarted and everything. – jaquinocode Jan 05 '22 at 21:51
6

Disabling typescript in the workspace options seems to be the one thing that stopped this warning for me:

"typescript.validate.enable": false,
Steve
  • 411
  • 1
  • 5
  • 5
0

I was facing the issue in Vuejs/Nuxtjs project:

  1. Check the jsconfig.json file in root and include the following things if not available already: "exclude": ["node_modules"]
{
    "compilerOptions": {
      "target": "es6",
      "baseUrl": "."
    },
    "exclude": ["node_modules"]
  }
  

Important

  1. If you are getting the error even after having these values then you SHOULD RESTART vs code application
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
0

Add "exclude": [ "node_modules/**/*", ], in the tsconfig.json file and if it still doesn't work, try reloading the VSCode by pressing Crtl + Shift + P and Reload Window and it should work.

Saman Salehi
  • 1,004
  • 1
  • 12
  • 19
-2

I also had some issues like this while using node modules. I just recreated the project copied and pasted all the code that i needed and installed every node modules after that i was able to fix the issue. However i dont recommend for large projects.