4

Error

ERROR in node_modules/angular-datatables/src/angular-datatables.module.d.ts(8,22): error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class node_modules/ng2-select2/ng2-select2.d.ts(3,22): error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

Ng version

            Angular CLI: 8.0.3
            Node: 12.4.0
            OS: win32 x64
            Angular: 8.0.1
            ... animations, cdk, common, compiler, compiler-cli, core, forms
            ... language-service, material, platform-browser
            ... platform-browser-dynamic, router, service-worker

            Package                           Version
            -----------------------------------------------------------
            @angular-devkit/architect         0.800.3
            @angular-devkit/build-angular     0.800.3
            @angular-devkit/build-optimizer   0.800.3
            @angular-devkit/build-webpack     0.800.3
            @angular-devkit/core              8.0.3
            @angular-devkit/schematics        8.0.3
            @angular/cli                      8.0.3
            @angular/http                     7.2.15
            @angular/pwa                      0.800.3
            @ngtools/webpack                  8.0.3
            @schematics/angular               8.0.3
            @schematics/update                0.800.3 (cli-only)
            rxjs                              6.5.2
            typescript                        3.4.5
            webpack                           4.30.0

Refrence https://angular.io/guide/ivy

Angular.json

        "architect": {
            "build": {
              "builder": "@angular-devkit/build-angular:browser",
              "options": {
                "outputPath": "dist",
                "index": "src/index.html",
                "aot": true,    

tsconfig.app.json

            {
          "extends": "../tsconfig.json",
          "compilerOptions": {
            "outDir": "../out-tsc/app",
            "baseUrl": "./",
            "module": "es2015",
            "types": []
          },
          "angularCompilerOptions": {
            "enableIvy": true
          },

by setting flag to false worked

 "angularCompilerOptions": {
"enableIvy": false
 },

Problem

  • after integrating Ivy error reproduce.
  • tried to remove node modules

  • ng serve works fine when remove ivy in config file.

  • any suggestion most welcome

Jeff Mercado
  • 129,526
  • 32
  • 251
  • 272
afeef
  • 4,396
  • 11
  • 35
  • 65
  • Add your component template and class file to the question. and content of package.json to see the libraries you are using to reproduce the error. consider creating a demo as well to recreate the error. – HDJEMAI Jun 24 '19 at 12:15
  • 1
    ivy is not stable – afeef Jun 25 '19 at 09:49
  • it is caused by the library. If the library is not build and publish properly, this error pops up. It is not thing to do with Ivy not being stable or not. It is more like Ivy requires a certain build. – maxisam Feb 13 '20 at 04:08

2 Answers2

2

I ran into the same issue. using Angular9.

this might not work for you but it did work for me.

cancelling ng serve and running it again somehow fixed it.

I also saw many threads about people with the same issue and like you said they turned off ivy rendered because it's causing bugs since it isn't complete yet.

Mohamed Aljamil
  • 389
  • 1
  • 9
  • I had the same issue and this solved it, I think adding a new module while "--watch" is active will cause some problems. – aliqandil Feb 15 '20 at 06:38
-1

Upgrade to Angular 9 worked for me ng update @angular/cli@9 @angular/core@9 --allow-dirty

Sagar
  • 645
  • 2
  • 9
  • 31