当我尝试编译我的angular 7源代码时,我遇到了一些编译时错误。
有人可以引导我吗?
我试图在Google上找到这些错误,并使用了一些文章。
请参阅我的tsconfig.json。
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2017",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
我什至添加了es6,但错误仍然相同。
我更新了以下软件包,但错误仍然相同。
"@types/node": "^10.12.18",
"ts-node": "^7.0.1",
"tslint": "^5.12.0"
我正在使用角度7.1.4和材质7.2.0。
错误在下面提到:
Severity Code Description Project File Line Suppression State
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\cdk\platform\typings\features\input-types.d.ts 9 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\common\src\directives\ng_class.d.ts 48 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\common\src\pipes\keyvalue_pipe.d.ts 47 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\common\src\pipes\keyvalue_pipe.d.ts 50 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\common\src\pipes\keyvalue_pipe.d.ts 51 Active
Error TS2304 (TS) Cannot find name 'Iterable'. ClientApp\node_modules\@angular\core\src\change_detection\differs\default_iterable_differ.d.ts 20 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\node_modules\@angular\core\src\change_detection\differs\default_keyvalue_differ.d.ts 31 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\change_detection\differs\default_keyvalue_differ.d.ts 39 Active
Error TS2304 (TS) Cannot find name 'Iterable'. ClientApp\node_modules\@angular\core\src\change_detection\differs\iterable_differs.d.ts 14 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\node_modules\@angular\core\src\change_detection\differs\keyvalue_differs.d.ts 22 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\di\reflective_provider.d.ts 93 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\node_modules\@angular\core\src\di\reflective_provider.d.ts 93 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\metadata\ng_module.d.ts 24 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\metadata\ng_module.d.ts 25 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\metadata\ng_module.d.ts 28 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\node_modules\@angular\core\src\metadata\ng_module.d.ts 29 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\core\src\render3\jit\compiler_facade_interface.d.ts 117 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\node_modules\@angular\core\src\render3\jit\compiler_facade_interface.d.ts 118 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\platform-browser\src\browser\browser_adapter.d.ts 86 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\platform-browser\src\dom\dom_adapter.d.ts 97 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\platform-browser\src\dom\shared_styles_host.d.ts 11 Active
Error TS2583 (TS) Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\@angular\platform-browser\src\dom\shared_styles_host.d.ts 22 Active
Error TS2585 (TS) 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\rxjs\internal\Observable.d.ts 82 Active
Error TS2304 (TS) Cannot find name 'Iterable'. ClientApp\node_modules\rxjs\internal\types.d.ts 35 Active
Error TS2585 (TS) 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\node_modules\rxjs\internal\types.d.ts 39 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\src\app\models\DynamicFlatNode.ts 18 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\src\app\models\DynamicFlatNode.ts 33 Active
Error TS1219 (TS) Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. ClientApp\src\app\models\DynamicFlatNode.ts 56 Active
Error TS1219 (TS) Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. ClientApp\src\app\models\TodoItemNode.ts 51 Active
Error TS1219 (TS) Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. ClientApp\src\app\models\TodoItemNode.ts 114 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. ClientApp\src\app\models\TodoItemNode.ts 116 Active
Error TS2583 (TS) Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.ClientApp\src\app\models\TodoItemNode.ts 119 Active
答案 0 :(得分:3)
我找到了以下解决问题的方法
npm install -D @types/node
答案 1 :(得分:0)
在源代码中搜索tsconfig文件,然后尝试将所有目标设置为es2017或es6。