Cannot load a C/C++ Addon

I need to make a native C API available to my Meteor app, but as a first step, I followed the Hello World Node.js example for C/C++ Addon here:
I did meteor npm install node-gyp.
Then, at the top level of my Meteor project, I created addons/hello, and copy and pastes the and binding.gyp files.
Then I did the node-gyp’s configure and build steps and can see the file addons/hello/build/Release/addon.node.

In server/main.js, I have code

Meteor.startup(() => {
console.log(“Server started”);
const addon = require(’…/addons/hello/build/Release/addon’);

When I run meteor, I get the error:

I20161104-14:23:14.060(-7)? Server started
W20161104-14:23:14.149(-7)? (STDERR) /xxx/.meteor/packages/meteor-tool/.1.4.1_2.tw7mp8++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20161104-14:23:14.149(-7)? (STDERR) throw(ex);
W20161104-14:23:14.149(-7)? (STDERR) ^
W20161104-14:23:14.150(-7)? (STDERR)
W20161104-14:23:14.150(-7)? (STDERR) Error: Cannot find module '…/addons/hello/build/Release/addon’
W20161104-14:23:14.150(-7)? (STDERR) at require (packages/modules runtime/.npm/package/node_modules/install/install.js:85:1)
W20161104-14:23:14.150(-7)? (STDERR) at server/main.js:16:19
W20161104-14:23:14.150(-7)? (STDERR) …

However, if I delete the addons/hello/build/Release/addon.node file, and create a simple JS module instead: addons/hello/build/Release/addon.js, my app finds the module, and loads it fine.
What am I missing?
Environment: Ubuntu 14.04 + Meteor

Really, no replies? You guys are killing me - I’m stuck. :slight_smile:

I have the same issue :frowning:

Have you found the solution for this error? I am also Stuck here :frowning:

Same problem here, trying to use a C++ module from Meteor. My node-gyp extension works fine if I load it directly from the node command line, but no luck using it from Meteor. If I do something like this:

var mystuff = require('/addons/mystuff/build/Release/mystuff.node');

I get an exception with this message:

Error: module.useNode() must succeed for native .node modules

A tutorial that shows how to integrate a C++ module with Meteor would be very useful…

did anyone ever get the C++ addons working?

1 Like