RHa*_*ris 10 typescript aurelia visual-studio-2017
我有一个可以构建和运行的 TypeScript 项目,但是我有很多构建错误,这些错误似乎都源于一个错误:
TS4090:(TS)在“C:/[projectpath]/node_modules/@types/node/index.d.ts”和“C:/[Microsoft 的用户路径]/Typescript/3.1/ node_modules/@types/node/index.d.ts'。考虑安装此库的特定版本以解决冲突。
我不明白“安装这个库的特定版本”。我不确定为什么会发现两个版本。
我的应用程序tsconfig.json在ClientApp文件夹中有一个文件。它包含以下内容:
{
"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}
}
Run Code Online (Sandbox Code Playgroud)
我typeAcquisition最近根据对与此相关的其他帖子的评论添加了最近的内容 - 但它没有影响。
我需要做什么才能“安装此库的特定版本”?
环境
该项目面向 .NetCore 2.2。该项目包含提供后端数据的 WebAPI 控制器以及包含使用 Aurelia 创建的 SPA UI 的 ClientApp 文件夹。我使用 WebPack 来构建 SPA 应用程序。
错误
小智 12
对我来说,我通过在编译器选项(tsconfig.json)中更改/添加“typeRoots”来修复它
"compilerOptions": {
....
"typeRoots": [
"node_modules/@types"
]
....
}
Run Code Online (Sandbox Code Playgroud)
4im*_*ble 11
我通过移动解决了这个问题
"@types/node": "^10.11.6"
Run Code Online (Sandbox Code Playgroud)
从devDependencies到peerDependencies我的package.json文件中
"peerDependencies": {
"@types/node": "^10.11.6"
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8158 次 |
| 最近记录: |