0

I am getting an error while i compile my angular as :

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"
  }
}
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247

1 Answers1

1

The problem is with single-spa-angular schematics which was fixed in v 3.5.3. It installs latest version even if you specify a version before if was fixed in v3.5.3.

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

Follow following steps

  1. Delete node_modules.
  2. Delete package-lock.json.
  3. remove single-spa-angular and single-spa from package.json.
  4. running ng add single-spa-angular@3.5.3
  5. Run npm install.
  6. Run your application.

For more information you can also read here :-

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

Aakash Garg
  • 10,649
  • 2
  • 7
  • 25
  • Yes, to worked. But while I import I am getting the error as :` Uncaught TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf () at extendStatics (tslib.es6.js:21) at __extends (tslib.es6.js:25) at extra-providers.ts:14 at Object. (extra-providers.ts:14) at Object.execute (amd.js:56) at Object.declaration.execute (named-exports.js:42) at doExec (system.js:478) at postOrderExec (system.js:474) at system.js:457` – 3gwebtrain Dec 11 '20 at 06:59
  • 1
    https://stackoverflow.com/questions/57421582/typeerror-object-prototype-may-only-be-an-object-or-null-undefined-angular-8 – Aakash Garg Dec 11 '20 at 07:02