简体   繁体   中英

I am getting this error when I deployed my React app on Github "Error: "line" is not a registered controller."

I created a React app and it works fine on my local machine, but after deployment in the Github I am getting the following error:

"Error: "line" is not a registered controller."

I read multiple solutions from stackoverflow, but none of them solved the issue. Here you can see the links for the articles which didn't work.

Chart.js core.js:6162 ERROR Error: "line" is not a registered controller

https://www.coder.work/article/7595319

Did someone had similar issue? How can I fix this bug

I found the way how to solve this issue. All I had to to do was import it from chart.js then import chart from "react-chartjs-2"

import {
  Chart as ChartJS,
  LinearScale,
  CategoryScale,
  BarElement,
  PointElement,
  LineElement,
  Legend,
  Tooltip,
  registerables as registerablesJS
} from "chart.js";
import { Chart} from "react-chartjs-2";
ChartJS.register(...registerablesJS);



ChartJS.register(
  LinearScale,
  CategoryScale,
  BarElement,
  PointElement,
  LineElement,
  Legend,
  Tooltip
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM