I have a TypeScript project that builds and runs, but I have a ton of build errors that all seem to stem from one error:
TS4090: (TS) Conflicting definitions for 'node' found at 'C:/[projectpath]/node_modules/@types/node/index.d.ts' and 'C:/[user path to Microsoft]/Typescript/3.1/node_modules/@types/node/index.d.ts'. Consider installing a specific version of this library to resolve the conflict.
I don't understand the bit about "installing a specific version of this library". I'm not certain why two versions are being found to begin with.
My app has a tsconfig.json
file located in the ClientApp
folder. It contains the following:
{
"compileOnSave": false,
"compilerOptions": {
"module": "esnext",
"skipLibCheck": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"target": "es2015",
"lib": [
"es2016",
"es2017",
"dom"
],
"moduleResolution": "node",
"allowJs": true,
"baseUrl": "src"
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"./custom_typings/**/*.d.ts"
],
"atom": {
"rewriteTsconfig": false
},
"typeAcquisition": {"enable": false}
}
I added the typeAcquisition
recently based on comments on other posts relating to this -- but it had no affect.
What do I need to do to "install a specific version of this library"?
Environment
The project targets .NetCore 2.2. The project contains WebAPI Controllers that serve up backend data as well as a ClientApp folder that contains a SPA UI created with Aurelia. I use WebPack to build the SPA application.
Errors
I fixed this by moving
"@types/node": "^10.11.6"
from devDependencies
to the peerDependencies
in my package.json
file
"peerDependencies": {
"@types/node": "^10.11.6"
},
For me, I fixed it by change/add "typeRoots" in compilerOptions (tsconfig.json)
"compilerOptions": {
....
"typeRoots": [
"node_modules/@types"
]
....
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With