CreateJS / EaselJS

The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.
http://createjs.com/
MIT License
8.11k stars 1.97k forks source link

Undefined is not an object #1032

Open jalorenz opened 4 years ago

jalorenz commented 4 years ago

Hi everyone,

i have a pretty strange bug, when creating a Stage.

var stage = new createjs.Stage("canvas"); console.log(stage);

The constructor immediately causes this error:

[Error] TypeError: undefined is not an object (evaluating 'c.t.addEventListener') — createjs.min.js:1393 Bg (react-dom.production.min.js:117:156) callback (react-dom.production.min.js:126) Ag (react-dom.production.min.js:116:410) zg (react-dom.production.min.js:116:151) qi (react-dom.production.min.js:131) ui (react-dom.production.min.js:133:323) (anonyme Funktion) (react-dom.production.min.js:158:380) unstable_runWithPriority (react.production.min.js:27) Vc (react-dom.production.min.js:158:363) Sc (react-dom.production.min.js:158:147) Z (react-dom.production.min.js:156:495) ah (react-dom.production.min.js:159:229) xf (react-dom.production.min.js:40) xf [Error] TypeError: undefined is not an object (evaluating 'c.t.addEventListener') Z (react-dom.production.min.js:157:194) ah (react-dom.production.min.js:159:229) xf (react-dom.production.min.js:40) xf

Its refers to line 1392 in create.min.js:

for (b in d) c = d[b], c.t.addEventListener(b, c.f, !1)

macOS, Safari, Windows, Internet Explorer 11

Pi-Bouf commented 4 years ago

You have a div with id canvas ? or just a <canvas></canvas> ?

jedateach commented 4 years ago

@jalorenz to help you debug / provide debugging information it can be useful to switch to use the non-minified version of the library. Just load create.js instead of create.min.js.

It's also useful for issues to drop the stack information into a code block

like this
block
here