javascript - How to use a .node file? -
i trying install node_mouse , when looked in node modules folder , instead of normal .js file extension, found .node file extension. how run node_mouse? looked , think might addon written in c++, i'm not sure(node addons)
yes, normal "require" usage appropriate .node files. point of these files create portable binaries (using node-gyp, c++) can referenced normal node requires. see hello.js section of node addon docs:
const addon = require('./build/release/addon'); console.log(addon.hello());
after looking npm lib, loaded node correctly on windows, mac, , linux vm's several different node versions, binary throws array of errors. on windows, has specific version of windows build target (likely nt, because windows 10 throws error):
error: %1 not valid win32 application.
on os x, dyld failing open shared library referenced binary. (see man dlopen):
error:dlopen(/.../node_mouse/node_mouse.node, 1): no suitable image found.
on linux, elf header error, tells binary can't run on os.
error: /app/available_modules/1484064894000/node_mouse/node_mouse.node: invalid elf header
the author seems lot of windows nt work, if need working, find fresh copy of windows nt dev add ons.
lastly, consider security risk of running third-party closed source binaries in code base (especially ones control mouse movement).
Comments
Post a Comment