[Chartjs]-Can't resolve 'chart.js/auto'

6👍

Installing the latest version of chart.js should fix this.

# with npm
npm install chart.js@latest

# with yarn
yarn add chart.js@latest

This will update chart.js to latest version (currently 3.3.0).

I believe it will work as long as the chart.js major version is 3+.


Here is a working Demo with the latest version of chart.js installed.


More notes

You are using v2 of chart.js but v3 of react-chartjs-2.

The react-chartjs-2 peer dependencies specify using chart.js version ^3.1.0. They also mention using v3 of chart.js in the README.

The npm or yarn install commands above should be enough if you are ok with using the latest version of chart.js.

Leave a comment