0

I am getting this error:

Uncaught TypeError: Cannot read property 'chocolate' of undefined

when building (ng build --prod) my Angular project with @clr version 0.12.6 and more.

Anybody got the same issue and if so, were you able to resolve it and how?

Anybody could tell me where the 'chocholate' property is used? That could help me to point out my issue.

Thanks

lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
David
  • 1,241
  • 20
  • 36
  • Did you let your code invisible? we should need the code visible first. – Rach Chen Aug 07 '18 at 10:45
  • We can't feel what's wrong with your code. You should let us see – E141 Aug 07 '18 at 10:47
  • As the error explains you're trying to read a property from a null/undefined object. Without your code is impossible to tell you more. – Francesco Serra Aug 07 '18 at 10:52
  • @Francesco For sure, my code does not have that property and really seems to come from Clarity. I have no issue when running with version 0.12.5. For the code, not sure which part could cause that issue because I don't know where Clarity is using that property. :-( – David Aug 07 '18 at 11:43
  • Can you please create a reproduction of this behavior? I have no issues with a new project with Clarity 0.12.6. In the past this has happened when people didn't update modules correctly or switched branches with different versions installed. Reset node_modules and get a clean copy to help test that. Also `chocolate` properties are for internal APIs. Are you also using Angular 6? – Jeremy Wilken Aug 07 '18 at 14:20
  • Hi @JeremyWilken, I am using angular 6.1. Uninstall and reinstall the 2 Clarity modules without success. I will see with a clean node_modules if I see the issue. – David Aug 07 '18 at 15:08
  • Hi again @JeremyWilken. Finally, by cleaning up all the node_modules and install everything back worked perfectly! Thanks for your help. – David Aug 07 '18 at 15:15

2 Answers2

2

Sometimes your node modules get out of sync, try deleting the directory and reinstalling. I recommend using NPM 5+ or Yarn to get a proper lock file to help keep this in sync better.

Jeremy Wilken
  • 6,965
  • 22
  • 21
0

Finally, by cleaning up all the node_modules directory and install everything again worked perfectly!

David
  • 1,241
  • 20
  • 36