Angular 9 Ivy compilation error
esoyke opened this issue · 5 comments
Expected Behavior
Compile properly on Angular 9
Actual Behavior
Compilation fails with error:
`ERROR in node_modules/ngx-cookie-service/lib/cookie.service.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
This likely means that the library (ngx-cookie-service) which declares CookieService has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
3 export declare class CookieService {
`
Steps to Reproduce the Problem
Error occurs at ng run, prevents app from loading
Specifications
Using Angular 9 (9.1.6). Using latest library version 3.4.0, tried rolling back to 3.0.3 with same result.
@esoyke que tal, ¿pudiste resolver el inconveniente?
tengo el mismo problema, recibo el siguiente mensaje al intentar ejecutar ng serve
Compiling ngx-cookie-service : module as esm5
Warning: Invalid constructor parameter decorator in /home/codespace/workspace/deks-website/node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.js:
() => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
{ type: InjectionToken, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
]
Error: getInternalNameOfClass() called on a non-ES5 class: expected CookieService to have an inner class declaration
at Esm5ReflectionHost.getInternalNameOfClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/host/esm5_host.js:88:23)
at DelegatingReflectionHost.getInternalNameOfClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/host/delegating_host.js:89:34)
at extractInjectableMetadata (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:125:69)
at InjectableDecoratorHandler.analyze (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:66:24)
at NgccTraitCompiler.TraitCompiler.analyzeTrait (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:345:40)
at analyze (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:297:58)
at _loop_1 (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:319:21)
at NgccTraitCompiler.TraitCompiler.analyzeClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:325:35)
at NgccTraitCompiler.analyzeFile (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:47:26)
at DecorationAnalyzer.analyzeProgram (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:134:39)
An unhandled exception occurred: NGCC failed.
See "/tmp/ng-C159IV/angular-errors.log" for further details.
el archivo angular-errors.log dice lo siguiente:
[error] Error: NGCC failed.
at NgccProcessor.process (/home/codespace/workspace/deks-website/node_modules/@ngtools/webpack/src/ngcc_processor.js:76:19)
at /home/codespace/workspace/deks-website/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:579:31
at SyncHook.eval [as call] (eval at create (/home/codespace/workspace/deks-website/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at SyncHook.lazyCompileHook (/home/codespace/workspace/deks-website/node_modules/tapable/lib/Hook.js:154:20)
at Object.webpack [as webpackFactory] (/home/codespace/workspace/deks-website/node_modules/webpack/lib/webpack.js:55:30)
at createWebpack (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:20:36)
at Object.runWebpackDevServer (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:46:12)
at SwitchMapSubscriber.project (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:191:32)
at SwitchMapSubscriber._next (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/switchMap.js:49:27)
at SwitchMapSubscriber.Subscriber.next (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18)
at /home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
at processTicksAndRejections (internal/process/task_queues.js:97:5)
@esoyke que tal, ¿pudiste resolver el inconveniente?
tengo el mismo problema, recibo el siguiente mensaje al intentar ejecutar
ng serve
Compiling ngx-cookie-service : module as esm5 Warning: Invalid constructor parameter decorator in /home/codespace/workspace/deks-website/node_modules/ngx-cookie-service/fesm2015/ngx-cookie-service.js: () => [ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }, { type: InjectionToken, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] } ] Error: getInternalNameOfClass() called on a non-ES5 class: expected CookieService to have an inner class declaration at Esm5ReflectionHost.getInternalNameOfClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/host/esm5_host.js:88:23) at DelegatingReflectionHost.getInternalNameOfClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/host/delegating_host.js:89:34) at extractInjectableMetadata (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:125:69) at InjectableDecoratorHandler.analyze (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:66:24) at NgccTraitCompiler.TraitCompiler.analyzeTrait (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:345:40) at analyze (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:297:58) at _loop_1 (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:319:21) at NgccTraitCompiler.TraitCompiler.analyzeClass (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:325:35) at NgccTraitCompiler.analyzeFile (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:47:26) at DecorationAnalyzer.analyzeProgram (/home/codespace/workspace/deks-website/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:134:39) An unhandled exception occurred: NGCC failed. See "/tmp/ng-C159IV/angular-errors.log" for further details.el archivo angular-errors.log dice lo siguiente:
[error] Error: NGCC failed. at NgccProcessor.process (/home/codespace/workspace/deks-website/node_modules/@ngtools/webpack/src/ngcc_processor.js:76:19) at /home/codespace/workspace/deks-website/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:579:31 at SyncHook.eval [as call] (eval at create (/home/codespace/workspace/deks-website/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1) at SyncHook.lazyCompileHook (/home/codespace/workspace/deks-website/node_modules/tapable/lib/Hook.js:154:20) at Object.webpack [as webpackFactory] (/home/codespace/workspace/deks-website/node_modules/webpack/lib/webpack.js:55:30) at createWebpack (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:20:36) at Object.runWebpackDevServer (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:46:12) at SwitchMapSubscriber.project (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:191:32) at SwitchMapSubscriber._next (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/switchMap.js:49:27) at SwitchMapSubscriber.Subscriber.next (/home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18) at /home/codespace/workspace/deks-website/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24 at processTicksAndRejections (internal/process/task_queues.js:97:5)
Lo he solucionado
No se si se trataba del mismo error, pero en ngx-cookie-service versión 10.0.1 no es compatible con Angular 9.1.11
Solución:
mi package.json ahora
"dependencies": {
"@angular/animations": "9.1.11",
"@angular/common": "9.1.11",
"@angular/compiler": "9.1.11",
"@angular/core": "9.1.11",
"@angular/fire": "6.0.0",
"@angular/forms": "9.1.11",
"@angular/http": "7.2.16",
"@angular/localize": "^9.0.6",
"@angular/platform-browser": "9.1.11",
"@angular/platform-browser-dynamic": "9.1.11",
"@angular/router": "9.1.11",
"ngx-cookie-service": "3.1.3"
Note la versión de ngx-cookie-service la degrade a 3.1.3
Espero te ayude. Saludos.
I don't remember how, but I got it working back in May. Perhaps I had deleted node_modules? Oddly I didn't put anything in my notes or update this issue, perhaps since I wasn't sure what resolved it. I am using v3.0.3.
I don't remember how, but I got it working back in May. Perhaps I had deleted node_modules? Oddly I didn't put anything in my notes or update this issue, perhaps since I wasn't sure what resolved it. I am using v3.0.3.
Excelente,
Change target: "es5" to es2015 will resolve this issue