question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 9 Ivy compile error

See original GitHub issue

I’ve enabled Angular Ivy support in my project and after refreshing my node_modules/package-lock.json files I had this error on the next ng serve after npm install

Expected result

Should (pre)compile without any error / ngx-select-dropdown needs Ivy support.

Actual result

ERROR in node_modules/ngx-select-dropdown/dist/ngx-select-dropdown.module.d.ts:1: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-select-dropdown) which declares SelectDropDownModule 
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.

1 export declare class SelectDropDownModule {

If I add following parameters to package.json --> scripts --> "postinstall": "ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points", ng serve will work again but I got following errors on first npm install:

Error: Failed to compile entry-point ngx-select-dropdown (module as esm5) due to compilation errors:
node_modules/@angular/common/common.d.ts:115:22 - error NG6002: Appears in the NgModule.imports of SelectDropDownModule,
but could not be resolved to an NgModule class.

This likely means that the library (@angular/common) which declares CommonModule 
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.

115 export declare class CommonModule {
                         ~~~~~~~~~~~~
node_modules/@angular/forms/forms.d.ts:2574:22 - error NG6002: Appears in the NgModule.imports of 
SelectDropDownModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/forms) which declares FormsModule 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.

2574 export declare class FormsModule {

Steps to reproduce

  1. My package.json:
{
    "name": "xxx",
    "version": "0.0.0",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "_comment": "ng serve --proxy-config proxy.conf.json",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "compodoc": "npx compodoc -p src/tsconfig.app.json",
        "postinstall": "ngcc"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "~9.1.12",
        "@angular/cdk": "^9.2.4",
        "@angular/common": "~9.1.12",
        "@angular/compiler": "~9.1.12",
        "@angular/core": "~9.1.12",
        "@angular/forms": "~9.1.12",
        "@angular/localize": "^9.1.12",
        "@angular/material": "^9.2.4",
        "@angular/platform-browser": "~9.1.12",
        "@angular/platform-browser-dynamic": "~9.1.12",
        "@angular/pwa": "^0.1001.0",
        "@angular/router": "~9.1.12",
        "@angular/service-worker": "~9.1.12",
        "@fortawesome/angular-fontawesome": "^0.6.1",
        "@fullcalendar/adaptive": "^5.3.1",
        "@fullcalendar/angular": "^5.3.1",
        "@fullcalendar/core": "^5.3.1",
        "@fullcalendar/daygrid": "^5.3.2",
        "@fullcalendar/interaction": "^5.3.1",
        "@fullcalendar/list": "^5.3.1",
        "@fullcalendar/resource-timeline": "^5.3.1",
        "@fullcalendar/timegrid": "^5.3.1",
        "@ng-bootstrap/ng-bootstrap": "^6.2.0",
        "@ng-select/ng-select": "^4.0.4",
        "@ngx-loading-bar/core": "^4.2.0",
        "@ngx-loading-bar/http-client": "^4.2.0",
        "@ngx-translate/core": "^12.1.2",
        "@ngx-translate/http-loader": "^5.0.0",
        "@types/jspdf": "^1.3.3",
        "angular-calendar": "^0.28.16",
        "angular-disable-browser-back-button": "^1.0.2",
        "angular-dual-listbox": "^5.0.1",
        "angularx-flatpickr": "^6.4.0",
        "bootstrap": "^4.5.2",
        "core-js": "^3.6.5",
        "flag-icon-css": "^3.5.0",
        "flatpickr": "^4.6.6",
        "font-awesome": "^4.7.0",
        "hammerjs": "^2.0.8",
        "http-server": "^0.12.3",
        "i18n-iso-countries": "^6.2.2",
        "jspdf": "^2.1.1",
        "jspdf-autotable": "^3.5.12",
        "just-detect-adblock": "^1.0.0",
        "lodash": "^4.17.20",
        "lowdb": "^1.0.0",
        "moment": "^2.27.0",
        "moment-timezone": "^0.5.31",
        "ng-click-outside": "^7.0.0",
        "ng-sidebar": "^9.4.2",
        "ng-simple-slideshow": "^1.2.9",
        "ngx-bottom-nav": "^0.5.0",
        "ngx-cookie-service": "^11.0.2",
        "ngx-device-detector": "^2.0.0",
        "ngx-mat-select-search": "^3.1.0",
        "ngx-pagination": "^5.0.0",
        "ngx-select-dropdown": "^1.5.0",
        "ngx-timer": "^1.0.6",
        "node-forge": "^0.10.0",
        "node-sass": "^4.12.0",
        "numeral": "^2.0.6",
        "opencage-api-client": "^0.10.0",
        "rxjs": "~6.6.3",
        "saturn-datepicker": "^8.0.5",
        "tippy.js": "^6.2.6",
        "tslib": "^2.0.1",
        "zone.js": "~0.11.1"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "^0.901.12",
        "@angular/cli": "^9.1.12",
        "@angular/compiler-cli": "^9.1.12",
        "@angular/language-service": "~9.1.12",
        "@types/jasmine": "~3.5.14",
        "@types/jasminewd2": "~2.0.8",
        "@types/lodash": "^4.14.161",
        "codelyzer": "~6.0.0",
        "eslint": "~7.8.1",
        "jasmine-core": "~3.6.0",
        "jasmine-spec-reporter": "~5.0.2",
        "karma": "^5.2.2",
        "karma-chrome-launcher": "~3.1.0",
        "karma-coverage-istanbul-reporter": "~3.0.3",
        "karma-jasmine": "~4.0.1",
        "karma-jasmine-html-reporter": "^1.5.4",
        "protractor": "~7.0.0",
        "ts-node": "~9.0.0",
        "typescript": "~3.8.3"
    }
}

  1. In tsconfig.json add: "angularCompilerOptions": { "enableIvy": true }

Your Environment

  • NodeJS v12.13.0
  • Operating System and version: Win 10 Pro 20H2

Workarounds

  • Remove : "scripts: { "postinstall": "ngcc" } from package.json
  • Add following parameters to postinstall: "postinstall": "ngcc --properties es2015 es5 browser module main --first-only --create-ivy-entry-points"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
manishjankycommented, Apr 4, 2021

Please update to v2.0.0

let me know if you face issues

1reaction
manishjankycommented, Mar 20, 2021

Let me have a look at this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Upgrade from 8 to 9 - Ivy Compilation Errors in ...
After the upgrade to 9 my angular application is working only with the Ivy disabled ("enableIvy": false in tsconfig.json). With Ivy enabled am ......
Read more >
App does not compile with Ivy - Angular 9 #32466 - GitHub
ERROR Error: Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! - JIT compilation is discouraged for ...
Read more >
Angular Ivy
Ivy is the code name for Angular's next-generation compilation and rendering pipeline. With the version 9 release of Angular, the new compiler and...
Read more >
Ahead-of-time (AOT) compilation - Angular
Detect template errors earlier, The AOT compiler detects and reports template binding errors during the build ... This is the default starting in...
Read more >
All Perks, No Hassle: An Angular 9 Tutorial - Toptal
Another big improvement introduced in Angular 9 and Angular Ivy is the debugging experience. The compiler now can detect more errors and throw...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found