./~/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.esm.js 找不到模块:无法解析 'chart.js/helpers'

./~/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.esm.js Module not found: Can't resolve 'chart.js/helpers'

我正在尝试使用 Chart.js 放大反应,但我一直收到此错误。 这是我的依赖项

"dependencies": {
    "chart.js": "^2.9.4",
    "chartjs-plugin-zoom": "^1.2.0",
    "patternomaly": "^1.3.2",
    "react": "^15.6.1",
    "react-chartjs-2": "^2.1.0",
    "react-dom": "^15.6.1"
  },

readme of the zoom plugin you need to use version 0.7.7 if you want to use it together with Chart.js V2. If you want to use the latest version of zoom you will need to update Chart.js to V3 but this has a lot of major breaking changes

中所述

For Chart.js 2.6.0 to 2.9.x support, use version 0.7.7 of this plugin.

要安装特定版本的库,您可以在它之后指定它,如下所示:

npm install chartjs-plugin-zoom@0.7.7