Base solution for your next web application
Open Closed

Angular Zero v4.5.1 ng build --prod error #3996


User avatar
0
piapps created

Hi guys,

Just wondering if anyone else using the Angular Zero project v4.5.1 is getting an error when compiling it for production?

From a blank project (fresh download from aspnetzero.com) if i go straight to angular folder and run ng build --prod

I get an error in /node_modules/primeng/components/dropdown/dropdown.d.ts.Dropdown.html (6,13) Type string is not assignable to type boolean

Not sure if anyone else has experienced this but I have managed to fix it but had to do several things which may be useful for others

  • Open package.json in the angular project and change the version of primeng from ^4.2.0-rc.1 to ^4.2.0
  • Run yarn so it updates primeng (confirm it updated 'npm list primeng')
  • Recompile for production and you will be hit with more errors this time it will be something about expecting 1 argument but getting 2 in several of zeros ts files. They all have null as second argument so you can just delete the problematic argument.
  • Recompile and it should work, however upon visiting the site you will be hit with a wierd error in js console 'Error: Cannot enable prod mode after platform setup.'
  • Open package.json and change the version of ngx-bootstrap from ^1.9.1 to ^1.9.2
  • Run yarn and confirm its updated
  • Recompile and voila

DISCLAIMER: I have no idea if updating those two angular modules has any other side effects. I have tested various parts of Zero afterwards but not thoroughly.


3 Answer(s)
  • User Avatar
    0
    ajayak created

    Hi @piapps,

    Use exact version of primeNg in package.json.

    "primeng": "4.2.0-rc.1",
    
  • User Avatar
    0
    piapps created

    I have it set to use the non release candidate version and that seems to work ok for me. Are you saying that switching to the exact RC version would also fix the issue without all the other errors?

  • User Avatar
    0
    ajayak created

    Yup. That's correct :) Use exact 4.2.0-rc.1