backend-core: Cannot find type definition file for 'web'. ts(2688)
See original GitHub issue- Review the documentation: https://docs.clerk.dev/
- Search for existing issues: https://github.com/clerkinc/javascript/issues
- Go through package changelog files.
- Provide the Frontend API key from your application dashboard.
Package + Version
-
@clerk/clerk-js
-
@clerk/clerk-react
-
@clerk/nextjs
-
@clerk/remix
-
@clerk/clerk-expo
-
@clerk/backend-core
-
@clerk/clerk-sdk-node
-
@clerk/edge
- other:
Version:
@clerk/clerk-sdk-node: ^3.2.2
@clerk/backend-core: ^1.1.0
@clerk/types: ^2.2.0
Browser/OS
OSX 12.3 Nodejs 16.14.2 Typescript 4.6.3
Description
My backend project refuses to compile correctly.
tsconfig.json:
{
"compilerOptions": {
"lib": ["es2020", "dom"],
"target": "es2020",
"module": "CommonJS",
"sourceMap": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"baseUrl": "./src",
"outDir": "./build",
"forceConsistentCasingInFileNames": true,
"strict": true,
"esModuleInterop": true,
"strictNullChecks": true
},
"files": ["..."],
"include": ["src/**/*.ts"]
}
Compilation errors :
node_modules/@clerk/backend-core/dist/cjs/api/resources/Props.d.ts(1,23): error TS2688: Cannot find type definition file for 'web'.
node_modules/@clerk/backend-core/dist/cjs/Base.d.ts(1,23): error TS2688: Cannot find type definition file for 'web'.
node_modules/@clerk/backend-core/dist/cjs/util/types.d.ts(1,23): error TS2688: Cannot find type definition file for 'web'.
It comes from /// <reference types="web" />
What is weird is that I do not have this issue in my nextjs frontend, with the same @clerk/backend-core version (same typescript, nodejs and @clerk/clerk-sdk-node).
But even in my nextjs project: when I open Props.d.ts
or Base.d.ts
or types.d.ts
: it says Cannot find type definition file for 'web'.ts(2688)
. But it compiles.
I tried several tsconfig changes. Nothing is working.
Any idea ?
Thanks.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
error TS2688: Cannot find type definition file for...random paths.
These errors occur when you have subdirectories of a typeRoots directory (in this case node_modules/@types ) that do not contain index.d.ts ...
Read more >Build:Cannot find type definition file for 'node' - Stack Overflow
The template I started with used an older version of Angular, so I updated the package references. When I build, the first error...
Read more >Cannot find type definition file for 'node' in TypeScript
To solve the error "Cannot find type definition file for node", install the node types by running npm i -D @types/node . If...
Read more >Error TS2688: Cannot find type definition file for 'node'
If am receiving this error when running the vtex link command: Webpack for react@3.x builder finished in 464ms with errors: [at-loader] ...
Read more >Release Notes for the UI5 Type Definitions - SAP
TS2688 Cannot find type definition file for 'node_modules'. This error can be displayed by the TypeScript compiler and at the first character of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nomocas Why was this issue closed? It’s definitely a problem with this package, and I’m not sure why @types/web is required for a backend package.
This is a bigger problem now because
@types/node
now conflicts@types/web
over theAbortSignal
declaration, necessitatingskipLibCheck: true
intsconfig.json
to compile:We should keep the issue open so that the maintainers can track/fix it.
Ok fixed :
I should add @types/web explicitly in my project, and remove “dom” in my tsconfig./lib entry.
tsconfig.json:
In the clerk mono-repo: @types/web is only added to the root of the mono-repo. Not in backend-core nor in clerk-sdk-node.
I believe that it should be added to avoid same issue next time.
In the frontend (
nextjs
with@clerk/nextjs
project with/api/...
stuffs that useclerk-sdk-node
), I do not find any @types/web (andyarn why @types/web
find it neither). So it’s not clear why it’s compiling in my frontend.But ok, it compiles in both.
Cheers.