Reputation: 357
I was already looking for an answer here on stackoverflow jsconfig.json gives ts errors. I tried:
"exclude": ["node_modules"]
in jsconfig.json
"noEmit": true
in jsconfig.json in "compilerOptions"
delete node_moduls and package-lock.json and after npm install
npm install --save @types/dotenv
Nothing helped :(
I work just with js files or jsx. My OS ubuntu (Focal Fossa). Сan someone explain to me from where the error coming from. And what does it have to do with TypeScript .And how to get rid of it completely? What else can I do besides what I have already done above?
Full error message is:
{
"resource": "path/jsconfig.json",
"owner": "typescript",
"severity": 8,
"message": "File 'path/node_modules/agent-base/dist/src/index' not found.\n The file is in the program because:\n Root file specified for compilation",
"source": "ts",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}
Upvotes: 14
Views: 37998
Reputation: 1
I deleted the folder of my project and used tsc --init the error is gone, I am using windows 11. That is, in an empty folder, for some reason, it worked..
Upvotes: -1
Reputation: 4066
Remove any comment from your .json
file. Comments, i.e. // my comment
are not valid JSON.
Upvotes: 0
Reputation: 81
I actually had similar problem which I managed to fix by changing TypeScript version in VS Code. Just open any JavaScript file and click on "Select language mode" button in the bottom right corner. It should allow you to select workspace TS version instead of global one.
Upvotes: 4
Reputation: 141
You can use the following method as a workaround in Visual Studio. File > Preferences > Settings, type "typescript validate" in the search bar, and uncheck the result.
Upvotes: 10