vscode
vscode copied to clipboard
typescript/lib/lib.d.ts not found in all jsconfig.json files without target
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.74.0 and 1.75.0-insider
- OS Version: Windows 11 x64 10.0.22621
Every project on my local system containing a jsconfig.json file without a target property has started reporting this error:
File 'd:/Program Files/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/lib.d.ts' not found.
The file is in the program because:
Default library for target 'es3'
Some projects have it multiple times, others only once. I freshly installed insiders to test, with no settings or extensions, and it occurs there too.
It doesn't occur if you have target
as one of your compiler options, but this wasn't necessary before. My code isn't compiled with typescript; I use jsconfig so vscode recognizes my files as being part of the same project, and other similar reasons.
Working as normal when target is specified:
Examples of the issue:
Steps to Reproduce:
- Open an empty folder in vscode
- Create an empty index.js file
- Create a jsconfig.json with valid properties without specifying a compiler options target.
Same question, when creating vite project:
pnpm create vite
# config...
cd my-proj
pnpm i
pnpm dev
9 Errors in tsconfig.node.json
:
[{
"resource": "/d:/WorkSpace/sanic-vue-exam/vue-simple-exam/tsconfig.node.json",
"owner": "typescript",
"severity": 8,
"message": "File 'd:/Pro/Microsoft VS Code/resources/app/extensions/node_modules/typescript/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es3'",
"source": "ts",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}]
I also had this error in tsconfig.node.json
.
I restarted TS Server in VSCode and then it fixed.
cmd + shift + p

I also had this error in
tsconfig.node.json
. I restarted TS Server in VSCode and then it fixed.
cmd + shift + p
![]()
I tried this, but it didn't work for me. I thought I was the only one with this issue after updating VS Code.
EDIT: So, what I did to fix this issue was copy a lib.d.ts file from a recent project I worked on to the lib directory. The error was no longer present after saving via the jsconfig.json file.
Before:
After:
EDIT #2: I downloaded an older version of VS Code for macOS (1.73.1) and copied the file from Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.d.ts. The reason was because the current version (1.74.0) did not have the file in the lib directory. I observed some of the lib.d.ts files on my Mac were different. The file in the lib directory looks like this:

Here is the code:
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es5" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
Igual me esta pasando, de la nada salio el problema.
Same issue on Mac Ventura
I am also having this issue on Mac Ventura. Restarting the Typescript server or even restarting VS Code only solves the problem for a few minutes, then it resurfaces.
Having the same issue. Tried the two solutions above and still having the same issue.
Having the same issue. Tried the two solutions above and still having the same issue.
Try downloading an older version of VS Code and copy the file from there to the location of the error you are seeing. Then, try saving via the jsonfig.json file.
I am also having this issue on Mac Ventura. Restarting the Typescript server or even restarting VS Code only solves the problem for a few minutes, then it resurfaces.
Try to download an older version of VS Code for Mac, say 1.73.1, and copy the lib.d.ts to the directory path Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib. The file is located in the same path the error shows. I restarted VS Code to see if the error would resurface. But, it has not. Hopefully, that fixes it.
Here is what worked for me!
Close the VS Code.
yarn global add next@latest
yarn global add typescript@latest
Open your project
rm -rf node_modules package-lock.json
Re-open your project!
Also, check your VS Code extension, Install the official Javascript & Typescript extension by Microsoft.
I hope this helps!
Thanks @sagargulati I just install the extension and with that works
Thank you @sagargulati. Installing the extension and restarting VSCode worked for me.
It worked for me too :)
Added "target": "esnext"
and now it just works.
# tsconfig.node.js
{
"compilerOptions": {
"target": "esnext",
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.ts"
]
}
Thanks @sagargulati. install the extension worked for me
Same in a create-vue
app, same cause.
I tried all the solutions suggested above but none of it worked. I am using React + Vite + Typescript.
The thing that solved my problem was to install @emotion/react @emotion/styled. Because I am using Material UI with Styled components and they are saying that there is some kind of problem with Styled Components and that they advise people to use Emotion.

I just did
cmd + shift + p
and used the Workspace version instead of VS Code. It worked.

Added
"target": "esnext"
and now it just works.# tsconfig.node.js { "compilerOptions": { "target": "esnext", "composite": true, "module": "ESNext", "moduleResolution": "Node", "allowSyntheticDefaultImports": true }, "include": [ "vite.config.ts" ] }
Thanks man. It's worked for me.
Added "target": "ESNext" and now it just works. { "compilerOptions": { "target": "ESNext", "composite": true, "module": "ESNext", "moduleResolution": "Node", "allowSyntheticDefaultImports": true }, "include": ["vite.config.ts"] }
@hbnxgdh is a Gigachad
I also had this error in
tsconfig.node.json
. I restarted TS Server in VSCode and then it fixed.
cmd + shift + p
![]()
This worked for me. Thanks
add "target": "esVersion" with esVersion like es6, es2017, es2020, ... in compilerOptions this worked for me :)
Seems fixed on Update 1.74.1. Thanks!
@daramir i confirm, the latest update works
Problem fixed on [email protected]
I also solved this problem in 1.74.1.