Core: Angular 9.1 => Compilation fails

Created on 9 Jul 2020  路  2Comments  路  Source: ngx-translate/core

Current behavior


Ran:

npm i @ngx-translate/core --save
npm i @ngx-translate/http-loader --save

Then tried npm start and got the following error:

Error: Error on worker #6: Error: getInternalNameOfClass() called on a non-ES5 class: expected TranslateFakeLoader to have an inner class declaration
    at Esm5ReflectionHost.getInternalNameOfClass (...\node_modules\@angular\compiler-cli\ngcc\src\host\esm5_host.js:88:23)
    at DelegatingReflectionHost.getInternalNameOfClass (...\node_modules\@angular\compiler-cli\ngcc\src\host\delegating_host.js:89:34)
    at extractInjectableMetadata (...\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\injectable.js:125:69)
    at InjectableDecoratorHandler.analyze (...l\nyp\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\injectable.js:66:24)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (...\nyp\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:345:40)
    at analyze (..\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:297:58)
    at _loop_1 
An unhandled exception occurred: NGCC failed.

I have tried the recommended fixes suggested in other issues like running:

npm cache verify
rm -rf node_modules
npm install

But I get the same error everytime.

My package.json looks like:

{
  "name": "Project Name",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-material-components/datetime-picker": "^2.0.3",
    "@angular-material-components/moment-adapter": "^2.0.1",
    "@angular/animations": "~9.1.0",
    "@angular/cdk": "^9.2.3",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/material": "9.2.3",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@types/fhir": "0.0.31",
    "angularx-social-login": "^2.3.1",
    "classlist.js": "1.1.20150312",
    "dateformat": "^3.0.3",
    "moment": "~2.24.0",
    "node-sass": "^4.14.1",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "web-animations-js": "2.3.2",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.0",
    "@angular/cli": "~9.1.0",
    "@angular/compiler-cli": "~9.1.0",
    "@angular/language-service": "~9.1.0",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
}

and my tsconfig.json is:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es5",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

Expected behavior


It should compile successfully

Environment


ngx-translate version: ^13.0.0
Angular version:  9.1.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: v12.16.2
- Platform:  Windows

Others:

Most helpful comment

Downgrade libs to:

    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^5.0.0",

13.0.0 core and 6.0.0 loader is for Angular 10

All 2 comments

Downgrade libs to:

    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^5.0.0",

13.0.0 core and 6.0.0 loader is for Angular 10

It compiles successfully after downgrading the libs. Thanks for the help!

Closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IterationCorp picture IterationCorp  路  3Comments

dankerk picture dankerk  路  3Comments

louisdoe picture louisdoe  路  3Comments

bjornharvold picture bjornharvold  路  3Comments

Snap252 picture Snap252  路  3Comments