I am getting below error in prod build.
"ngx-toastr": "^11.2.0",
Error:
ERROR in ./node_modules/ngx-toastr/fesm2015/ngx-toastr.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 (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:265:35)
at checkNodeForDecorators (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:77:21)
at visitNodes (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16514:30)
at Object.forEachChild (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16740:24)
at checkNodeForDecorators (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31)
at visitNode (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16505:24)
at Object.forEachChild (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16635:21)
at checkNodeForDecorators (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31)
at visitNode (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16505:24)
at Object.forEachChild (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16703:24)
at checkNodeForDecorators (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31)
at visitNode (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16505:24)
at Object.forEachChild (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16692:24)
at checkNodeForDecorators (D:\customer\ng-customer-place\node_modules\@angular-devkit\build-optimizer\src\transforms\scrub-file.js:68:31)
at visitNode (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16505:24)
at Object.forEachChild (D:\customer\ng-customer-place\node_modules\typescript\lib\typescript.js:16599:21)
ng --version
ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.0
Node: 10.16.0
OS: win32 x64
Angular: 8.2.3
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.3
@angular-devkit/build-angular 0.801.3
@angular-devkit/build-optimizer 0.801.3
@angular-devkit/build-webpack 0.801.3
@angular-devkit/core 8.1.3
@angular-devkit/schematics 8.3.0
@angular/animations 8.2.5
@angular/cdk 8.1.4
@angular/cli 8.3.0
@angular/material 8.1.4
@ngtools/webpack 8.1.3
@schematics/angular 8.3.0
@schematics/update 0.803.0
rxjs 6.5.2
typescript 3.4.5
webpack 4.35.2
angular.json
"styles": [
"src/styles.scss",
"src/assets/scss/style.scss",
"node_modules/ngx-toastr/toastr.css"
],
Using ivy?
Having the same issue. Not using ivy.
Angular CLI: 8.3.17
Node: 10.14.0
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
@angular-devkit/architect 0.800.6
@angular-devkit/build-angular 0.800.6
@angular-devkit/build-optimizer 0.800.6
@angular-devkit/build-webpack 0.800.6
@angular-devkit/core 8.0.6
@angular-devkit/schematics 8.3.17
@angular/cdk 8.2.3
@angular/cli 8.3.17
@angular/material 8.2.3
@angular/material-moment-adapter 8.2.3
@ngtools/webpack 8.0.6
@schematics/angular 8.3.17
@schematics/update 0.803.17
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
I had the same issue. Seems like 11.2.0 broke some things.
Going back to 11.1.1 works fine.
"ngx-toastr": "11.1.1",
not having any issues building with no ivy on a new angular 8 project. Maybe try upgrading to these newer versions. or if you can take https://github.com/scttcper/ng8-toastr-11-kind-error and have it error in a similar way
Angular CLI: 8.3.17
Node: 10.16.3
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.17
@angular-devkit/build-angular 0.803.17
@angular-devkit/build-optimizer 0.803.17
@angular-devkit/build-webpack 0.803.17
@angular-devkit/core 8.3.17
@angular-devkit/schematics 8.3.17
@angular/cli 8.3.17
@ngtools/webpack 8.3.17
@schematics/angular 8.3.17
@schematics/update 0.803.17
rxjs 6.5.3
typescript 3.5.3
webpack 4.39.2
With this version "ngx-toastr": "11.1.1" it works, Let me update to latest version of ng8.
Thank you for your response.
Having the same issue. Not using ivy.
Angular CLI: 8.2.2
Node: 12.13.0
OS: Windows 10 x64
Angular: 8.2.13
Version 11.1.2 works fine.
Reverting to 11.1.2 worked for me also. Need to deploy a prod build over the next couple of days. After that will look into upgrading ng8 and trying again with 11.2.
It's worth mentioning that this only happens on an AOT build with 11.2.0. A JIT (non AOT) build comiles just fine with 11.2.0...
reverted the only other change that happened between 11.1.2 and 11.2.0. I'm guessing its ng-packagr
Most helpful comment
I had the same issue. Seems like
11.2.0broke some things.Going back to
11.1.1works fine."ngx-toastr": "11.1.1",