I am trying to write a C++ module for Node Js for a USB device. It is an accesio USB-IIRO-16 I/O board (accesio.com/MANUALS/USB-IIRO-16.PDF). I have the linux drivers installed along with libusb on Ubuntu 12.04 LTS. I have the sample apps (written in C++) running fine with the I/O board and am able to communicate with it just fine in C++. I'm new to writing nodejs modules, and haven't written C++ since college either. I have the module compiling fine as well. I am using the USBDeviceManager class provided by accesio which they use in their sample app.
I used this as a base for the module:
https://github.com/kkaefer/node-cpp-modules/tree/master/06_objects
I replaced the hpp file with the USBDeviceManager provided by accesio that is used in the sample app, and added ObjectWrap
class USBDeviceManager : public node::ObjectWrap {...}
The rest is the same as the USBDeviceManager along with the example module code. Everything compiles fine, however, when I run the node run.js I receive:
module.js:485
process.dlopen(filename, module.exports);
^
Error: /home/parallels/Documents/node-accesio/build/Release/accesio.node: undefined symbol: _ZTVN6AIOUSB16USBDeviceManagerE
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/parallels/Documents/node-accesio/run.js:1:77)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I've tried a lot of moving code around and some online documentation but can not figure out what to do at this point. The cpp and js files are still the same as the example module app right now (https://github.com/kkaefer/node-cpp-modules/tree/master/06_objects). the only thing that's different is adding the USBDeviceManager to the hpp file and the AIOUSB namespace.
Basically what I want to do, is to be able to read/write to the I/O board similar to the sample application found here:
http://accesio.com/files/packages/AIOUSB-Latest.tar.gz
Related
Working on a project. Built a C++ module for node, compiled it with cmake. I tried using the module in my main electron app but it errors out.
Reproduced it with a minimal repo here: https://github.com/Aerrus/electronMinimal
App threw an error during load
Error: Module did not self-register.
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:722:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (C:\Users\xxx\electronMinimal\mods\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\xxx\electronMinimal\mods\index.js:1:188)
Saw a lot of threads already about rebuilding it, making sure the node version when I built it was the same, and so on. None of them changed anything.
If you're using electron v4.0
take a look at this. I hope it helped because that's how I solved the problem
adding delay hook to cmakelist using cmake-js
I'm trying to run 64 bit zipped GitKraken on an ArchLinux build machine (where I do not have super privileges), and the latest version of GitKraken (3.3.4) seems to have changed/broken something with lib curl.
With a previous release (3.1.1, 64 bit), I was able to run just by calling gitkraken. Then, at some point, I had to preload the correct (older) curl library like so to get GK to run:
LD_PRELOAD=/usr/lib/libcurl.so.3 ~/gitkraken/gitkraken.
With 3.3.4, it won't run with using the direct call to gitkraken:
/usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by
/home/kmiller/gitkraken/resources/app.asar.unpacked/node_modules/nodegit/build/Release/nodegit.node)),
If I do specify it, it seg faults:
LD_PRELOAD=/usr/lib/libcurl.so.3 ~/gitkraken/gitkraken Node started
time: 1519142744860 Segmentation fault (core dumped)
If I specify libcurl4, it wants version 3:
LD_PRELOAD="/usr/lib/libcurl.so.4" ~/gitkraken/gitkraken Node started
time: 1519154390224 /usr/lib/libcurl.so.4: version CURL_OPENSSL_3'
not found (required by
/home/kmiller/gitkraken/resources/app.asar.unpacked/node_modules/nodegit/build/Release/nodegit.node)
Error: /usr/lib/libcurl.so.4: versionCURL_OPENSSL_3' not found
(required by
/home/kmiller/gitkraken/resources/app.asar.unpacked/node_modules/nodegit/build/Release/nodegit.node)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:187:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/home/kmiller/gitkraken/resources/app.asar/node_modules/nodegit/dist/nodegit.js:11:12)
at Object. (/home/kmiller/gitkraken/resources/app.asar/node_modules/nodegit/dist/nodegit.js:1031:3)
Thank you in advance. GitKraken help sent me here :slightly_smiling_face:
Solution:
The preload library for 3.3.4 is gnutls, you can then run GitKraken like this:
LD_PRELOAD=/usr/lib/libcurl-gnutls.so.3 ~/gitkraken/gitkraken
I cannot get tests in WebStorm to work for a React project I am working on.
I have the JavaScript language version set to React JSX, which means I have no compile errors.
Next I found a test example on the web and pasted it into a test file in my /test folder.
Magically some green arrows appear next to functions like describe and it. I click on one of these green arrows and run a test. Immediately I get this error :
/home/swe/Repositories/WebClient/code/tests/test2.js:21
<div>
^ SyntaxError: Unexpected token <
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Why am I getting this error?
I am guessing that my compile JS is set to JSX, but whatever JavaScript is used by the test runner (I am thinking back to Java days) is using another JavaScript version.
I cannot find anything in the settings.
In fact I am not clear at all on how WebStorm uses testing. WebStorm recognises describe and it, which means, I am guessing, that WebStorm has Jasmine support.
In the settings I cannot find anything about Jasmine however. There is
something about 'Karma' in the plugins panel. I am guessing that this plugin also uses Jasmine.
in the ionic app
trying to run ionic emulate ios but following error is coming
ionic-hello-world# ionic:build /Users/farrukhqamar/HybridApps/helloWorld
ionic-app-scripts build
keywords if/then/else require v5 option
/Users/farrukhqamar/HybridApps/helloWorld/node_modules/node-sass/lib/index.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (51)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.10.1
at Object. (/Users/farrukhqamar/HybridApps/helloWorld/node_modules/node-sass/lib/index.js:13:11)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/farrukhqamar/HybridApps/helloWorld/node_modules/#ionic/app-scripts/dist/sass.js:11:19)
at Module._compile (module.js:571:32)
In the morning every thing was working but just start happening now in my current project
If i create a new project then it runs perfectly.
I am very new in ionic so please suggest some solution
Runtime (Node Module ABI) version 51 means it's an Electron environment, which node-sass doesn't directly support.
I've written a native addon for node.js, compiled it with MSVC++ without node-gyp, and used it successfully on the node REPL and in an application. I'm using x64 node and compiling an x64 addon. I'm trying to get the thing to build with node-gyp. I've gotten node-gyp to generate a Visual Studio solution and compile it, but the addon that comes out does not work. The only error I get is this:
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at repl:1:13
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface.<anonymous> (repl.js:250:12)
When I run a script that tries to load the addon, I get this:
module.js:480
process.dlopen(filename, module.exports);
^
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (c:\blah\testheaders.js:1:75)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I've learned that dlopen has something to do with loading dynamic libraries on Linux, but can't find any useful information relevant to node (in particular, on Windows.). This addon requires some third-party dlls, but they are on my path, and again, the addon works fine when I compile it without node-gyp.
What do I need to do to figure out how to make this work?
It turned out that the problem lay in my use of the NODE_MODULE macro. I had something like this:
NODE_MODULE(SomeAddonName, Init)
But my binding.gyp had this:
"target_name": "totallyDifferentName",
It turns out that target_name in binding.gyp must be the same as the module name (the first argument to NODE_MODULE).
Thanks to #TooTallNate for helping me with this!