Open robogeek opened 7 years ago
Try to install it from git, not from npm, because npm now contain old version.
Then try brew install libmosbus
I finally got back to this. I did: git clone git@github.com:tuxnsk/nodejs_libmodbus.git
and then in the directory with my test code did npm install ../nodejs_libmodbus/
The install seemed to have run correctly ... but
$ node index.js
before createData
Segmentation fault: 11
I'd also done this, as suggested:
$ brew install libmodbus
Warning: libmodbus-3.1.1 already installed
Warning: You are using a pre-release version of Xcode.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
The code is:
ar mb = require('modbus').create();
// create device memory map
console.log('before createData');
var data = mb.createData({ countReg: 5, countBit: 2 });
console.log('after createData');
data.dumpData();
data.setReg(2, 321);
data.setBit(1, true);
data.dumpData(); // show memory map
...
Therefore the crash happens in mb.createData
and is different from the crash reported above.
I've read through #4 BTW ... I have a similar issue, but with 10.11.6. With the "Create slave device" sample I get this output:
Because this did not print the data dump at this call
data.dumpData(); // show memory map
it suggests the error is while callingmb.createData
. I inserted a couple console.log statements before and aftermb.createData
and it doesn't print anything after that call.During "npm install" I don't see anything suggesting possible problems - there are a couple warnings at the end.