[Chartjs]-./node_modules/chart.js/dist/chart.js 695:18 Module parse failed: Unexpected token (695:18)

5👍

Your project is very probably compiled for a TypeScript version that is incompatible with the v4 of chart.js
I resolved my issues by installing version 3, you can use this command:

npm i --save chart.js@3.9.1

The best option would probably be to update all the libs and TypeScript configurations, so that you could use the v4.

1👍

We have to use specific versions of chart.js and react-chartjs-2.

For chart.js v2:

npm install --save chart.js@^2.9.4 react-chartjs-2@^2.11.2

For chart.js v3:

npm install --save chart.js@^3.6.0 react-chartjs-2@^4.0.0

Also make sure to restart server after installing the package.

Refer here

Leave a comment