尝试命令ng serve时出现错误TS 2694



当我试图运行我的angular应用程序时,我遇到了这些严重的错误,老实说,我不知道出了什么问题,也许有人可以帮助我。我没有做任何特别的事情,我只是添加了一个组件,之后程序就不起作用了。我试图删除node_modules文件夹,但没有帮助我,还尝试了npm安装,但没有效果。

Error: ../../../../../../node_modules/@angular/core/src/application_init.d.ts:29:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
29     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ApplicationInitStatus, [{ optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_init.d.ts:30:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
30     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<ApplicationInitStatus>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_module.d.ts:32:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
32     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ApplicationModule, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_module.d.ts:33:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵNgModuleDeclaration'.
33     static ɵmod: ɵngcc0.ɵɵNgModuleDeclaration<ApplicationModule, never, never, never>;
~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_module.d.ts:34:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectorDeclaration'.
34     static ɵinj: ɵngcc0.ɵɵInjectorDeclaration<ApplicationModule>;
~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_ref.d.ts:145:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
145     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<PlatformRef, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_ref.d.ts:146:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
146     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<PlatformRef>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_ref.d.ts:312:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
312     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ApplicationRef, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/application_ref.d.ts:313:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
313     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<ApplicationRef>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/console.d.ts:12:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
12     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<Console, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/console.d.ts:13:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
13     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<Console>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/linker/compiler.d.ts:71:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
71     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<Compiler, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/linker/compiler.d.ts:72:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
72     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<Compiler>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts:39:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
39     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<SystemJsNgModuleLoader, [null, { optional: true; }]>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts:40:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
40     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<SystemJsNgModuleLoader>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/testability/testability.d.ts:90:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
90     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<Testability, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/testability/testability.d.ts:91:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
91     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<Testability>;
~~~~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/testability/testability.d.ts:134:25 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDeclaration'.
134     static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<TestabilityRegistry, never>;
~~~~~~~~~~~~~~~~~~~~
Error: ../../../../../../node_modules/@angular/core/src/testability/testability.d.ts:135:26 - error TS2694: Namespace '"C:/Users/Matei/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDeclaration'.
135     static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<TestabilityRegistry>;

以下是我运行ng版本时的版本:

Angular CLI: 13.2.6
Node: 16.13.1
Package Manager: npm 8.2.0
OS: win32 x64
Angular: 13.2.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.6
@angular-devkit/build-angular   13.2.6
@angular-devkit/core            13.2.6
@angular-devkit/schematics      13.2.6
@schematics/angular             13.2.6
rxjs                            6.6.7
typescript                      4.5.5

这是我的package.json文件

{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.2.6",
"@angular/common": "~13.2.6",
"@angular/compiler": "~13.2.6",
"@angular/core": "~13.2.6",
"@angular/forms": "~13.2.6",
"@angular/platform-browser": "~13.2.6",
"@angular/platform-browser-dynamic": "~13.2.6",
"@angular/router": "~13.2.6",
"bootstrap": "^4.5.3",
"font-awesome": "^4.7.0",
"ngx-bootstrap": "^7.1.2",
"ngx-bootstrap-navbar": "^1.0.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.2.6",
"@angular/cli": "~13.2.6",
"@angular/compiler-cli": "~13.2.6",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.5.5"
}
}

如果您需要更多信息或代码文件,请告诉我。非常感谢!!

我在中遇到了类似的问题angular-in-memory-web-api@0.13.0和我尝试的几个选项在这篇文章中:npm警告。。。需要…的同行。。。但是没有安装。您必须自己安装对等依赖项

这一个有类似的方法无法解决我的Angular应用程序和我的自定义Angular库之间的对等依赖关系