0

After I updated my global angular CLI to the latest, this error came up. I searched and it might be because my local cli version (1.5.0) is not being used for some reason. Now I can't build the project due to this error:

ERROR in node_modules/angularx-social-login/src/providers/facebook-login-provider.d.ts(10,35): error TS1039: Initializers are not allowed in ambient contexts.

Here is my package.json:

    "@angular/cli": "1.5.0",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@netbasal/content-loader": "^1.0.3",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "@types/hammerjs": "^2.0.35",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/mousetrap": "^1.6.0",
    "@types/node": "~6.0.60",
    "agm-overlays": "^1.3.3",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"

Have you got any ideas how to solve it?

y3v2btr93iq
  • 45
  • 2
  • 9
  • Where are you using the loginprovider? any code you can show? – nircraft Jul 31 '19 at 18:54
  • Check out their issue https://github.com/abacritt/angularx-social-login/issues/181 been open since may maybe downgrade to 1.2.6 – misha130 Jul 31 '19 at 19:45
  • @misha130 I try to downgrade to typescript@1.2.6 but it says that no matching version was found. – y3v2btr93iq Aug 01 '19 at 05:30
  • Ok in general the error is that angularx-social-login doesnt support your typescript version (too high) – misha130 Aug 01 '19 at 05:35
  • @misha130 It's interesting that there was no error whatsoever until I updated my global CLI version to the latest, which is weird, because the project uses local cli version as default. I think the problem is that the local cli version is not being used (idk why) and thus it is not compatible with typescript version. – y3v2btr93iq Aug 01 '19 at 05:46
  • You could run npm scripts to ./node_modules/@angular/cli/bin/ng instead of just ng to be sure – misha130 Aug 01 '19 at 05:48

1 Answers1

0

As I understand it, this is an issue with typescript older than 3.1 per this reference. https://github.com/firebase/firebase-admin-node/issues/599

There are other websites that detail the problem that the new syntax for initializing a variable is not accepted by older compilers. See this answer: Initializers are not allowed in ambient contexts error when installing Blueprint

redevill
  • 341
  • 1
  • 3
  • 9