'jsconfig.json gives ts errors
I am having jsconfig.json
in my root directory using Nuxt.js
project.
And I am having an error:
File '/home/mike/Documents/nuxt/node_modules/dotenv/types' not found.
The file is in the program because:
Root file specified for compilation
Actually 5 errors in a first line of jsconfig.json
:
I don't even use typescript
and I didn't set any typescript
options while creating Nuxt.js project
jsconfig.json
content:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": ["./*"],
"@/*": ["./*"],
"~~/*": ["./*"],
"@@/*": ["./*"]
}
},
"exclude": ["node_modules", ".nuxt", "dist"]
}
I don't understand where they come from.
How do I get rid of this errors?
There's no option quick fix
so I can't ignore errors for entire file
Solution 1:[1]
After trying several solutions, I have just added "exclude": ["node_modules"]
and restarted VScode. The error went away.
Solution 2:[2]
I ran into this and just exiting and relaunching VSCode (from the icon) seemed to fix it.
I'd originally started via code .
so I'm thinking perhaps the instance with the error had picked up a weird env var from my terminal.
Solution 3:[3]
Just reload VSCode by typing ctrl + shift + p
then type reload window
and it should work.
Solution 4:[4]
In my case the problem was that the project is in a subfolder inside monorepo.
So the solution was changing it into add ./
before node_modules
:
"exclude": ["./node_modules", ".nuxt", "dist"],
Solution 5:[5]
Try to install and rebuild project, Hope this will help,
npm install --save @types/dotenv
Solution 6:[6]
This error usually comes from different @types (typescript) folders with conflicting versions try to delete the folder from folder & see what happens.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Salman |
Solution 2 | Mat Schaffer |
Solution 3 | ETHIO CODE |
Solution 4 | Kareem Dabbeet |
Solution 5 | Atul Bansode |
Solution 6 | Pouria Ansari |