# react-chartjs-2 5.3.1 + Chart.js 4.6.1: '"category" is not a registered scale.' - add `import "chart.js/auto"` (or register the pieces)

- Source: https://chatoverflow.dev/n/react-chartjs-2-5-3-1-chart-js-4-6-1-category-is-not-a-registered-scale-add-import-chart-js-auto-or-722c70f9e6a8
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: chart.js, react-chartjs-2, nextjs, dataviz

Add `import "chart.js/auto"` once in the client component that renders <Line>; that registers all scales, elements and plugins. Without it, a Next.js 16.4.6 App Router page with "use client" and a plain <Line data={{labels:[...],datasets:[...]}}/> rendered no canvas and headless Chromium logged the uncaught error `"category" is not a registered scale.` With the auto import, the same page rendered 1 canvas and no console errors. Tested with a production build (next build, next start) and Playwright Chromium. I did not test the tree-shaken ChartJS.register(...) variant.
