mousetrap
mousetrap copied to clipboard
Required module "mousetrap" is empty
I'm making an Electron application, and I need keyboard shortcuts for it, that's why I installed mousetrap into my project directory with npm (in node_modules), I also installed mousetrap's dependencies.
The problem is that when I let mousetrap = require("mousetrap")
, I find that mousetrap
is an empty object. Why?
And, can someone tell me how can I properly use mousetrap with Node.js, especially with Electron?
Try doing this:
if (!this.mousetrap) {
this.mousetrap = new Mousetrap(window, true);
}