angulartypescriptquillngx-quill

Angular project locally work fine but When it Building it gives bellow error in Quill Editor


I'm using angular 8 + quill for my project and everything works fine in local with ng serve. but when i tried to deploy it i'm getting below issue. i look in to lot of issues and nothing work for me. update angular , Delete node_module and so ..!

this is the error i'm getting

ERROR in ./node_modules/ngx-quill/fesm2015/ngx-quill.js Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js): TypeError: Cannot read property 'kind' of undefined at isAngularDecoratorMetadataExpression (/Users/liyanaarachchi/XXXXXX/iXXXXX/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35) at checkNodeForDecorators (/Users/liyanaarachchi/XXXX/iXXXt/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21) at visitNodes (/Users/liyanaarachchi/iXXX/iXXXX/node_modules/typescript/lib/typescript.js:16514:30) at Object.forEachChild (/Users/liyanaarachchi/xxxx/iXXXXXX/node_modules/typescript/lib/typescript.js:16740:24) at checkNodeForDecorators (/Users/liyanaarachchi/iXXXX/XXXXXX/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/Users/liyanaarachchi/XXXX/XXXX/node_modules/typescript/lib/typescript.js:16505:24) at Object.forEachChild (/Users/liyanaarachchi/ibrainmart@gmail.com/ibrainmart/node_modules/typescript/lib/typescript.js:16635:21) at checkNodeForDecorators (/Users/liyanaarachchi/ibraiXXXXm/iXXXart/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/Users/liyanaarachchi/ibXXXm/XXXt/node_modules/typescript/lib/typescript.js:16505:24) at Object.forEachChild (/Users/liyanaarachchi/ibrXXXXXcom/XXXX/node_modules/typescript/lib/typescript.js:16703:24) at checkNodeForDecorators (/Users/liyanaarachchi/ibXXXXl.com/XXXXXt/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/Users/liyanaarachchi/ibrXXXXm/iXXXXrt/node_modules/typescript/lib/typescript.js:16505:24) at Object.forEachChild (/Users/liyanaarachchi/XXXXXXom/ibXXXXart/node_modules/typescript/lib/typescript.js:16692:24) at checkNodeForDecorators (/Users/liyanaarachchi/ibraiXXXXm/ibXXXXart/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/Users/liyanaarachchi/ibXXXXX/iXXXXXart/node_modules/typescript/lib/typescript.js:16505:24) at Object.forEachChild (/Users/liyanaarachchi/ibrainmXXXXXm/ibXXXXXt/node_modules/typescript/lib/typescript.js:16599:21)

packge.json

   {
  "name": "ibrainmart",
  "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": {
    "@agm/core": "^1.1.0",
    "@angular/animations": "^8.1.3",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.1.3",
    "@angular/compiler": "~8.1.3",
    "@angular/core": "~8.1.3",
    "@angular/forms": "~8.1.3",
    "@angular/material": "^8.1.2",
    "@angular/platform-browser": "~8.1.3",
    "@angular/platform-browser-dynamic": "~8.1.3",
    "@angular/router": "~8.1.3",
    "@aws-amplify/ui": "^1.0.23",
    "@fortawesome/angular-fontawesome": "^0.5.0",
    "@fortawesome/free-solid-svg-icons": "^5.10.1",
    "@ng-bootstrap/ng-bootstrap": "^5.1.1",
    "@ng-select/ng-select": "^3.0.7",
    "angular-animate": "^1.7.8",
    "angular-bootstrap-datetimepicker": "^4.0.2",
    "angular-font-awesome": "^3.1.2",
    "angular-material": "^1.1.19",
    "angular-messages": "^1.7.8",
    "angular-multiple-select": "^1.1.3",
    "angular-popper": "^2.0.1",
    "angular-sortablejs": "^2.7.0",
    "aws-amplify": "^1.1.36",
    "aws-amplify-angular": "^3.0.11",
    "bootstrap": "^4.4.1",
    "bootstrap-table": "^1.15.3",
    "bootstrap4-toggle": "^3.5.0",
    "dropify": "^0.2.2",
    "e": "0.0.4",
    "font-awesome": "^4.7.0",
    "guid-typescript": "^1.0.9",
    "jquery": "^3.4.1",
    "material-design-icons": "^3.0.1",
    "moment": "^2.24.0",
    "ng-pick-datetime": "^7.0.0",
    "ng-sortgrid": "^1.3.3",
    "ngx-bootstrap": "^5.1.1",
    "ngx-float-button": "^1.0.0",
    "ngx-google-places-autocomplete": "^2.0.4",
    "ngx-highlightjs": "^4.0.2",
    "ngx-image-cropper": "^2.1.2",
    "ngx-image-editor": "^1.4.1",
    "ngx-paypal": "^5.0.0",
    "ngx-quill": "^7.3.12",
    "ngx-select-dropdown": "^1.1.0",
    "ngx-sortablejs": "^3.1.3",
    "open-iconic": "^1.1.1",
    "paypal-checkout": "^4.0.308",
    "popper.js": "^1.15.0",
    "quill": "^1.3.7",
    "rxjs": "~6.4.0",
    "sortablejs": "^1.10.0-rc3",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.801.3",
    "@angular/cli": "^8.3.23",
    "@angular/compiler-cli": "~8.1.3",
    "@angular/language-service": "~8.1.3",
    "@types/googlemaps": "^3.39.1",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.3.31",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  }
}

tsconfig.json

`{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"types": ["googlemaps"],
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]

},

"angularCompilerOptions": {
"fullTemplateTypeCheck": false,
"strictInjectionParameters": true
}
}

`

can some one tell me why i'm getting this error

angular.json

`{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ibrainmart": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/XX",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css",
"node_modules/ngx-select-dropdown/dist/assets/style.css"

        ],
        "scripts": [
          "node_modules/jquery/dist/jquery.min.js",
          "node_modules/bootstrap/dist/js/bootstrap.min.js",
          "node_modules/dropify/dist/js/dropify.js"


        ]
      },
      "configurations": {
        "DEV": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.dev.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "4mb",
              "maximumError": "5mb"
            }
          ]
        },
        "STAG": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.stage.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "4mb",
              "maximumError": "5mb"
            }
          ]
        },
        "PROD": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "8mb",
              "maximumError": "10mb"
            }
          ]
        },
        "LIVE": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.live.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "4mb",
              "maximumError": "5mb"
            }
          ]
        }
      }
    },
    "serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "iXXXXX:build"
      },
      "configurations": {
        "production": {
          "browserTarget": "XXXX:build:production"
        }
      }
    },
    "extract-i18n": {
      "builder": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "browserTarget": "XXX:build"
      }
    },
    "test": {
      "builder": "@angular-devkit/build-angular:karma",
      "options": {
        "main": "src/test.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.spec.json",
        "karmaConfig": "karma.conf.js",
        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "./node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
          "./node_modules/bootstrap/dist/css/bootstrap.min.css",
          "src/styles.css"
        ],
        "scripts": []
      }
    },
    "lint": {
      "builder": "@angular-devkit/build-angular:tslint",
      "options": {
        "tsConfig": [
          "tsconfig.app.json",
          "tsconfig.spec.json",
          "e2e/tsconfig.json"
        ],
        "exclude": [
          "**/node_modules/**"
        ]
      }
    },
    "e2e": {
      "builder": "@angular-devkit/build-angular:protractor",
      "options": {
        "protractorConfig": "e2e/protractor.conf.js",
        "devServerTarget": "XXX:serve"
      },
      "configurations": {
        "production": {
          "devServerTarget": "XXX:serve:production"
        }
      }
    }
  }
}
},
"defaultProject": "XXX"
}`

Solution

  • You have two solution to solve it

    if you want to know more information you can check this link https://github.com/ckeditor/ckeditor4-angular/issues/78


    1. Set buildOptimizer to false of your package.json

     "configurations": {
            "DEV": {
              ...
              "buildOptimizer": false,
            },
            "STAG": {
               ...
              "buildOptimizer": false,
            },
            "PROD": {
               ...
              "buildOptimizer": false,
            },
            "LIVE": {
              ...
              "buildOptimizer": false,
            }
          }
        },


    2. Change the version of angular-devkit

    "devDependencies": { 
    "@angular-devkit/architect": "~0.803.20", 
    "@angular-devkit/build-angular": "~0.803.20", 
    "@angular-devkit/core": "~8.3.20", 
    "@angular-devkit/schematics": "~8.3.20",
     },