[Chartjs]-TypeError: Cannot read property 'defaults' of undefined when using the react wrapper of chartjs

9👍

Which version of chart.js are you running because if you reinstalled it its a high chance you are running version 3 of the lib which is at the moment still not compatible with the wrapper so you will have to install the latest version 2 release of chart.js (2.9.4)

3👍

Yes, thanks now this solution also work for me,

I was using chart.js with a version of >3.x

then I have downgrade the version to 2.9.4 then it worked for me.

Yarn Command

yarn add react-chartjs-2

yarn add chart.js@2.9.4

-1👍

First

npm uninstall react-chartjs

then

npm i react-chartjs-2@2.9.0

Leave a comment