Chartjs-React-chartjs error Cannot read property 'Chart' of undefined

1👍

You are declaring LineChart twice. Change the name of one of them, for example:

var MyChart = React.createClass({ /* rest of your code */ });
module.exports = MyChart;

0👍

I also have the same issue, and ‘npm cache clean’ helps!
It may related to the dependency of chartjs & react-chartjs.

-1👍

I had the same problem. Exclusion of node_modules in Webpack build helped. Look at this https://github.com/jhudson8/react-chartjs/issues/93.

Here’s an example “module” section of webpack.config.js:

module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules)/,
        loader: 'babel-loader'
      }
    ]
  }

Leave a comment