self.on is not a function
See original GitHub issueCode I try to run:
var HID = require('node-hid');
var device = HID.HID(21324, 1);
The resulting error:
self.on("newListener", function(eventName, listener) {
^
TypeError: self.on is not a function
at Object.HID (/home/peepee/dev/trezor-connection/node_modules/node-hid/nodehid.js:48:7)
at Object.<anonymous> (/home/peepee/dev/trezor-connection/lib/index.js:43:18)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Function.Module.runMain (module.js:431:10)
at startup (node.js:141:18)
at node.js:977:3
When I digged deeper, it seems the HID never inherits eventemitter correctly. I am not sure why.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How do I get around the error TypeError: self._form.on is not a ...
It seems the reason that this occurs is that when handling an error, the request module uses the .on method on a FormData...
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >JavaScript Function Definitions - W3Schools
Function expressions can be made "self-invoking". A self-invoking expression is invoked (started) automatically, without being called. Function expressions will ...
Read more >self in Python, Demystified - Programiz
This is the reason the first parameter of a function in class must be the object itself. Writing this parameter as self is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh. That’s because I call
var foo = HID.HID(21324, 1)
the correct call is
var foo = new HID.HID(21324, 1)
That’s about it.
I don’t think so. I’ll close this issue anyway, if you find out anything, please update enhancement issue #150. Thanks!