node_modules/@angular/core/core"' 没有导出成员 'ɵɵFactoryDeclaration'。对于 Angular-in-memory-web-api“^0.18.0”

问题描述 投票:0回答:1

我按照https://v8.angular.io/tutorial/toh-pt6中的教程进行操作,当我运行npm start时,许多错误来自node_modules/angular-in-memory-web-api/index.d。 ts,如下所示:

node_modules/angular-in-memory-web-api/index.d.ts 中的错误:38:19 - 错误 TS1086:无法在环境上下文中声明访问器。

38 protected get dbReady(): Observable; ~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:264:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵFactoryDeclaration”。

264静态ɵfac:i0.ɵɵFactoryDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:265:22 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵInjectableDeclaration”。

265静态ɵprov: i0.ɵɵInjectableDeclaration; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:297:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵFactoryDeclaration”。

297静态ɵfac: i0.ɵɵFactoryDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:298:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵNgModuleDeclaration”。

298静态ɵmod: i0.ɵɵNgModuleDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:299:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵInjectorDeclaration”。

299静态ɵinj: i0.ɵɵInjectorDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:312:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵFactoryDeclaration”。

312静态ɵfac:i0.ɵɵFactoryDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:313:22 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵInjectableDeclaration”。

313静态ɵprov: i0.ɵɵInjectableDeclaration; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:428:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵFactoryDeclaration”。

428静态ɵfac:i0.ɵɵFactoryDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:429:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵNgModuleDeclaration”。

429静态ɵmod:i0.ɵɵNgModuleDeclaration; ~~~~~~~~~~~~~~~~~~~~~ node_modules/angular-in-memory-web-api/index.d.ts:430:21 - 错误 TS2694:命名空间 '“{path}/angular-tour-of-heroes/node_modules/@angular/core/core”' 有 没有导出成员“ɵɵInjectorDeclaration”。

430静态ɵinj:i0.ɵɵInjectorDeclaration; ~~~~~~~~~~~~~~~~~~~~~

我的package.json的dependency/devDependencies部分如下:

"dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/http": "^7.2.16",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "angular-in-memory-web-api": "^0.18.0",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.25",
    "@angular/cli": "~8.3.26",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }

如何修复这些错误?

angular
1个回答
0
投票

好的,我改成

npm install [电子邮件受保护] --save

服务器现在可以正常启动了。

© www.soinside.com 2019 - 2024. All rights reserved.