Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Cannot read property 'Chart' of undefined #93

Open
donnrri opened this issue Mar 31, 2016 · 12 comments
Open

Cannot read property 'Chart' of undefined #93

donnrri opened this issue Mar 31, 2016 · 12 comments

Comments

@donnrri
Copy link

donnrri commented Mar 31, 2016

Hi,

I cannot find many details as to why I am getting an error when trying to render a chart using react-chartjs. I'm using react v0.13 and webpack.
I use the following code :

var LineChart = require("react-chartjs").Line;
var React = require('react');

var LChart = React.createClass({

propTypes: {
data: React.PropTypes.object
},
render: function() {

return <LineChart data={this.props.data} options={this.props.options} width="600" height="250"/>

}
});

module.exports = LChart;

but when I use this component within my app I get the error Cannot read property 'Chart' of undefined line 10 Chart.js . Is this a commonly found error and I am missing the solution somewhere ? Thanks for any comments

@danmolitor
Copy link

Did you specifically run "npm install chart.js" in your terminal when you installed react-chartjs?

@Qquanwei
Copy link

Qquanwei commented Apr 5, 2016

I installed the chart.js, but the problems still exist

@hydrotik
Copy link

hydrotik commented Apr 8, 2016

Make sure you install npm install chart.js --save not npm install chartjs --save I did that myself and got that error, realizing the package was wrong when trying to manually adjust it in the module.

@JamieDixon
Copy link

I'm receiving this same error Uncaught TypeError: Cannot read property 'Chart' of undefined with chart.js@^1.1.1 installed. Any ideas?

@jbarata
Copy link

jbarata commented May 10, 2016

same problem here

@yeliex
Copy link

yeliex commented May 13, 2016

++
@jhudson8

@nickstanish
Copy link

Same issue. Excluding node_modules from babel-loader fixed it.

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

@BabOuDev
Copy link

+1

1 similar comment
@Baluhariharan
Copy link

+1

@jakubkoci
Copy link

I had the same problem, but as @nickstanish suggested in his response, node_modules exclusion in Webpack solved this. Thanks.

@emirdeliz
Copy link

Thanks @nickstanish works for me!

@ismatim
Copy link

ismatim commented Jan 24, 2018

In my case was the incorrect version installed 1.1. should be ^2.

UPDATE: The error was quite different Cannot read property 'bar' of undefined

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests