Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on nodejs #535

Closed
LLFourn opened this issue Dec 7, 2017 · 5 comments
Closed

Doesn't work on nodejs #535

LLFourn opened this issue Dec 7, 2017 · 5 comments
Labels

Comments

@LLFourn
Copy link

LLFourn commented Dec 7, 2017

> require('matter-js').Engine.create()
TypeError: Cannot read property 'nodeType' of undefined
    at Object.Common.isElement (/root/server/node_modules/matter-js/build/matter.js:4449:23)
    at Object.Engine.create (/root/server/node_modules/matter-js/build/matter.js:4846:26)
    at repl:1:29
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at REPLServer.defaultEval (repl.js:240:29)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:441:10)
    at emitOne (events.js:120:20)
    at REPLServer.emit (events.js:210:7)
> 
root@7d42879a986e:~/server# cat node_modules/matter-js/package.json | grep version
    "gulp-tag-version": "^1.3.0",
  "version": "0.14.0"
@liabru
Copy link
Owner

liabru commented Dec 7, 2017

Ugh I thought I'd solved that! Looks it needs to handle undefined.

@liabru liabru added the bug label Dec 7, 2017
@AaronPorts
Copy link

Maybe Common.isElement can return false; instead of return !!(obj.nodeType && obj.nodeName)?

@Smeky
Copy link

Smeky commented Dec 31, 2017

+1

A possible workaround that worked for me:
return obj && !!(obj.nodeType && obj.nodeName);

@AryanJ-NYC
Copy link

@Smeky's workaround worked for me.

@liabru liabru closed this as completed in ec38eeb Jan 10, 2018
@AryanJ-NYC
Copy link

Thanks @liabru! Fix works for me.

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

No branches or pull requests

5 participants