尝试运行命令 ng serve 时出现了 TS 2694 错误。
尝试运行命令 ng serve 时出现了 TS 2694 错误。
当我尝试运行我的Angular应用程序时,出现了这些讨厌的错误。说实话,我不知道出了什么问题,也许有人可以帮帮我。我没有做任何特别的事情,只是添加了一个组件,之后程序就无法工作了。我尝试删除node_modules文件夹,但没有帮助,也尝试了npm install,但无济于事。
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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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; ~~~~~~~~~~~~~~~~~~~~~~~ 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;
这是运行ng version时显示的版本:
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" } }
如果您需要更多信息或代码文件,请告诉我。非常感谢!!
admin 更改状态以发布 2023年5月22日
我遇到了与angular-in-memory-web-api@0.13.0类似的问题,我尝试了一些选项,在这篇文章中:npm WARN ... requires a peer of ... but none is installed. You must install peer dependencies yourself
这篇文章有类似的解决方法:Could not resolve peer dependency between my Angular app and my custom Angular library