角度 8 抛出错误"没有导出成员'ɵ浏览器平台位置'。



我在将角度编译为时出错

ERROR in node_modules/single-spa-angular/src/extra-providers.d.ts:2:10 - error TS2305: Module '"D:/trails/spa-angular-shared/login/node_modules/@angular/common/common"' has no exported member 'ɵBrowserPlatformLocation'.
2 import { ɵBrowserPlatformLocation, LocationChangeEvent } from '@angular/common';
~~~~~~~~~~~~~~~~~~~~~~~~

package.json:

{
"name": "login",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:single-spa:login": "ng build login --prod --deploy-url http://localhost:4203/",
"serve:single-spa:login": "ng s --project login --disable-host-check --port 4203 --deploy-url http://localhost:4203/ --live-reload false"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@angular/common": "~8.2.0",
"rxjs": "~6.4.0",
"single-spa": ">=5.4.0",
"single-spa-angular": "^3.1.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8",
"@angular-devkit/build-angular": "~0.803.10",
"@angular/cli": "~8.2.0",
"@angular/compiler-cli": "~8.2.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.5.3"
}
}

问题在于单spa角度示意图,该示意图已在3.5.3版中修复。它安装最新版本,即使您之前指定了一个版本,if在3.5.3版中已修复。

https://github.com/single-spa/single-spa-angular/releases/tag/v3.5.3

遵循以下步骤

  1. 删除node_modules
  2. 删除package-lock.json
  3. 从package.json中删除single-spa angular和single-spa
  4. 正在运行ng添加single-spa-angular@3.5.3
  5. 运行npm install
  6. 运行您的应用程序

有关更多信息,您也可以阅读此处:-

https://github.com/single-spa/single-spa-angular/issues/208https://github.com/single-spa/single-spa-angular/pull/231

最新更新