VSCode jsconfig.json error "node_modules/agent-base/dist/src/index" not found
Asked Answered
I

5

38

Why is VSCode showing this error?

It's just a jsconfig.json file.

NOTE: I'm not using TypeScript.

enter image description here

Impassive answered 5/7, 2020 at 10:15 Comment(0)
P
65

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

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

Peyton answered 27/8, 2020 at 5:43 Comment(4)
This worked. Restarting VSCode is very important in this case.Poor
I had to include a slash for it work "node_modules/"Meet
It's enough to restart the TS Server instead of restarting VS Code. Open the command palette and search for: TypeScript: Restart TS Server.Grovel
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.Edenedens
M
6

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

"typescript.validate.enable": false,
Manara answered 1/10, 2021 at 19:25 Comment(1)
The only response that actually fixed it for me. Thanks Steve!Magnitude
T
1

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.

Telegonus answered 15/12, 2021 at 4:17 Comment(1)
It's damn correct, worth thousand likes!Steffy
H
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
Hayashi answered 10/11, 2021 at 14:58 Comment(0)
W
-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.

Woodenware answered 27/8, 2020 at 6:2 Comment(2)
I found I need a slash in the path for this to work: "exclude": ["node_modules/"]Etymologize
Just FYI, this not considered as solution, it's a workaround that solved your problem by chance!.Hulse

© 2022 - 2024 — McMap. All rights reserved.