angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

prod build failed

Open tandalevaibhav opened this issue 7 years ago • 13 comments

My Angular CLI version is (7.3.9) , Node 10.16.3, Typescript 3.1.6 When I run:- ng build --prod It failes with the following Error. `Date: 2019-10-16T10:51:09.356Z Hash: 5e96b3d4506b7e0309e2 Time: 33576ms chunk {0} common.1c16b66e2dc9707a3b58.js (common) 15.9 kB [rendered] chunk {1} runtime.bcd245d37dfc345066e0.js (runtime) 2.33 kB [entry] [rendered] chunk {2} 2.68b747abb47eb68d0533.js () 830 kB [rendered] chunk {3} main.beeb15859443d2425509.js (main) 2.26 MB [initial] [rendered] chunk {4} polyfills.c6e355a6d69372a21900.js (polyfills) 41 kB [initial] [rendered] chunk {5} styles.1f662db96d381bd4672f.css (styles) 188 kB [initial] [rendered] chunk {6} 6.f86474f62f6e0801aebb.js () 106 kB [rendered] chunk {7} 7.776c1f6c1132d75799b3.js () 3.73 kB [rendered] chunk {8} 8.dc79e1074e7fa12fbc60.js () 134 kB [rendered] chunk {9} 9.b07a3235bd266d8a4cca.js () 163 kB [rendered] chunk {10} 10.10df86d42d2d0c674b10.js () 234 kB [rendered] chunk {11} 11.8e7b16f672f75856651e.js () 76 kB [rendered] chunk {scripts} scripts.091d3f4f3258ad6e9f29.js (scripts) 161 kB [entry] [rendered]

ERROR in ./node_modules/ng2-material-dropdown/fesm5/ng2-material-dropdown.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 (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:265:35) at checkNodeForDecorators (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:77:21) at visitNodes (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16144:30) at Object.forEachChild (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16370:24) at checkNodeForDecorators (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/home/vaibhavnode_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24) at Object.forEachChild (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16265:21) at checkNodeForDecorators (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24) at Object.forEachChild (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16322:24) at checkNodeForDecorators (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24) at Object.forEachChild (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16333:24) at checkNodeForDecorators (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/src/transforms/scrub-file.js:68:31) at visitNode (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16135:24) at Object.forEachChild (/home/vaibhav/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:16229:21) ` But ng serve works fine

tandalevaibhav avatar Oct 16 '19 11:10 tandalevaibhav

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

The fix of this was https://github.com/angular/angular-cli/pull/13992 which is available in version 8+

alan-agius4 avatar Oct 16 '19 13:10 alan-agius4

I am using CLI version 8.2.0 but I am still getting same issue.

Suyog-Sankey avatar Oct 16 '19 14:10 Suyog-Sankey

Hi, I have the same problem. I updated the cli version but I'm still getting the same issue.

wrubio avatar Oct 16 '19 16:10 wrubio

Hi. I have the same problem. This issue is close and where is the solution?

andres-gismondi avatar Oct 16 '19 17:10 andres-gismondi

I just mentioned the previous version in package.json and it solved my issue for now. The previous version does not have this issue while prod build.

Suyog-Sankey avatar Oct 16 '19 18:10 Suyog-Sankey

I was able to solve the problem, leaving the version of "ngx-chips" that it has defined without taking the latest version.   from: "ngx-chips": "^ 2.0.2", to: "ngx-chips": "2.0.2",

in the package.json.

In my case this was the temporary solution, because the error it gives me is from a library that uses ngx-chips:

ERROR in ./node_modules/ng2-material-dropdown/fesm5/ng2-material-dropdown.js.

wrubio avatar Oct 16 '19 19:10 wrubio

I solve the problem leaving the version of ng-multiselect-dropdown to 0.2.4

from "ng-multiselect-dropdown": "^0.2.4", to "ng-multiselect-dropdown": "0.2.4".

andres-gismondi avatar Oct 17 '19 12:10 andres-gismondi

thanks @andres-gismondi your solution help me to overcome this issue. my local angular CLI version of project is : ^8.0.3

i downgrade from "ng-multiselect-dropdown": "^0.2.6", to "ng-multiselect-dropdown": "0.2.4".

and the issue got fixed for production build.

chetanmore0510 avatar Oct 18 '19 10:10 chetanmore0510

@wrubio thanks! your solution worked for me.

tandalevaibhav avatar Oct 18 '19 10:10 tandalevaibhav

thanks @andres-gismondi your solution help me to overcome this issue. my local angular CLI version of project is : ^8.0.3

i downgrade from "ng-multiselect-dropdown": "^0.2.6", to "ng-multiselect-dropdown": "0.2.4".

and the issue got fixed for production build.

To me its works using version "0.2.3"

robertop87 avatar Oct 24 '19 15:10 robertop87

works in 0.2.3 or me too

kmjayadeep avatar Nov 17 '19 00:11 kmjayadeep

Works for me the solution from wrubio, thanks!! on package.json: "ngx-chips": "^2.0.2", remove ^ and change to "ngx-chips": "2.0.2", Run in console the "npm install" command, this will get the 2.0.2 version and quit the last version 2.1.0 Run the ng build

axelosorio avatar Dec 03 '19 06:12 axelosorio

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.