Repository navigation
[@types/node] Compiler error: Cannot find module 'undici-types' #67406
Replies: 15 comments 2 replies
|
Thanks for the discussion about "node", some useful links for everyone: Pinging the DT module owners: @microsoft, @jkomyno, @alvis, @r3nya, @btoueg, @smac89, @Touffy, @DeividasBakanas, @eyqs, @Hannes-Magnusson-CK, @hoo29, @kjin, @ajafff, @islishude, @mwiktorczyk, @mohsen1, @n-e, @galkin, @parambirs, @eps1lon, @ThomasdenH, @WilcoBakker, @wwwy3y3, @samuela, @kuehlein, @bhongy, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @ZYSzys, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky. |
|
Try to reinstall dependencies. |
|
The issue seems to only occur when building with yarn, building with pnpm works as expected |
|
Same issue started appearing in a release from 3 weeks ago |
|
This definitely seems like a bug with the types, running tsc will yield In a project that does not need or use nodenext for modules. (or undici or any other dependencies) |
|
If you are coming across this in your own projects, as a workaround, you can {
"compilerOptions": {
"paths": {
// This is solely to stop a bug with @types/node as of 12/15/2023
"undici-types": [
"./node_modules/undici-types/index.d.ts"
],
}
}
}And it will work for now. |
|
In my case, the culprit was |
|
This is only an issue if you are not using
This has no effect for me. |
|
I just ran into the same issue. Because of this bug, merely installing ... even though the code being compiled didn't use any Node types. The suggestion to set For now I've downgraded |
|
Some external libraries may require the use of Commonjs. In such cases, you may encounter problems, and you will need to find alternative solutions .Adding "Moduleresolution": "Node" to your TSCONFIG.JSON file helps the Typescript compiler to determine how to allow modules. This can be useful if you switch your project to use ES6 modules, especially when problems arise with resolving modules and conflicts with various modules systems. |
|
I had the same issue and what resolved it was to create a separate config file for the type script files that were causing it (in my case client.ts):
|
|
For me, this is causing failure on a basic TypeScript project with no dependencies other than |
|
I just ran into this nasty issue after installing the selenium-webdriver and chrome-driver. Adding "types": [], to my tsconfig.json file did remove the errors from my compilation step. However, I knew this didn't address the underlying issue. Taking a look at my "node_modules" directory under my project and snooping around revealed the root cause of the problem. The fix explains it all. Go into the "node_modules/@types" folder. Look for "node/node_modules/undici-types". Move the "undici-types" folder so that it is under"node_modules/@types". That did the trick for me. |
|
Just ran into this issue, enabling "skipLibCheck": true skips type-checking node_modules and solved the problem for me. |
|
This helped me: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I am unable to compile Firefox extension using web-ext because of the following error in
@types/nodemoduleAll reactions