for some unknown reason a freshly generated angular 14.1 project does not work. it seems like npm i will download corrupt libs. deleting node_modules won’t help.. the file (node_modules/@types/node/stream/web.d.ts) in my existing projects looks differently.. i wasn’t able to find anything similar on the internet… any idea? thanks!
Error: node_modules/@types/node/stream/web.d.ts:484:13 - error TS2502: 'ReadableByteStreamController' is referenced directly or indirectly in its own type annotation.
484 var ReadableByteStreamController: typeof globalThis extends
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: node_modules/@types/node/stream/web.d.ts:503:13 - error TS2502: 'ReadableStreamBYOBReader' is referenced directly or indirectly in its own type annotation.
503 var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T }
~~~~~~~~~~~~~~~~~~~~~~~~
Error: node_modules/@types/node/stream/web.d.ts:513:13 - error TS2502: 'ReadableStreamBYOBRequest' is referenced directly or indirectly in its own type annotation.
513 var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T }
~~~~~~~~~~~~~~~~~~~~~~~~~
5
I had the same issue and just solved it in the following way.
Set the skipLibCheck
flag to true in the angularCompilerOptions
inside your tsconfig.json
file.
{
"angularCompilerOptions": {
"skipLibCheck": true
}
}
This tells TypeScript to skip type checking for third-party libraries, which can help avoid circular reference issues.
1
Downgrade “@types/node” in devDependencies of package.json. “ng new” puts the latest version for this dependency which has breaking changes for a few older features.
"devDependencies": {
...
"@types/node": "^20.3.2",
...
}
1
In my case i was able to solve it because i had the package-lock.json
of the project that i just cloned, if you have it you could use npm ci
instead of npm install to make sure you have all the dependencies as before
Try change angular version. Of course, the best solution would be to use the latest stable version (~18.2.1) if there is no reason to work with such an old one.