I'm working with Meteor running on localhost:3000.
I used 'npm install require' to install require in the app directory.
As near as I can tell it installed properly. Yet I'm still getting the error...
Exception while invoking method 'zeroMQSend' ReferenceError: require is not defined
I've tried the solutions here:
ReferenceError: Require is not defined (Webstorm)
I believe Meteor is running the node.js server??, so that should be the issue.
I tried this solution here: Uncaught ReferenceError: require is not defined
But the method is defined in the server folder. That shouldn't be the problem either.
Here's the code in the server folder that's invoking the error:
Meteor.methods({
    zeroMQSend: function (sendJson) {
        var zmq = require('zmq');
        var Future = Npm.require("fibers/future");
        var fut = new Future();
        console.log('Sending thru zeroMQ : %s', sendJson);
        var socket = zmq.socket('req');
        socket.connect('tcp://localhost:5555');
        socket.send(sendJson);
        socket.on('message', function(data) {
            console.log('Reply: ' + data);
            fut['return'](data);
        });
        return fut.wait();
    }
});
Here's the code on the client side calling the method:
Template.TrendTrader.events({
    'click #go_button': function () {
        console.log('"go" button clicked');
        var p1_time = trend_p1_time.value;
        var p1_price = trend_p1_price.value;
        var p2_time = trend_p2_time.value;
        var p2_price = trend_p2_price.value;
        console.log('Trend point 1 time: ', p1_time, ' Price: ', p1_price);
        console.log('Trend point 2 time: ', p2_time, ' Price: ', p2_price);
        var trend_line_Json = '{"trend_p1_time": "p1_time", "trend_p1_price": "p1_price",' +
            ' "trend_p2_time": "p2_time", "trend_p2_price": "p2_price"}';
        Meteor.call('zeroMQSend', trend_line_Json);
    }
});
Here's the full error:
20151201-22:41:12.179(2)? Exception while invoking method 'zeroMQSend' ReferenceError: require is not defined
I20151201-22:41:12.179(2)?     at [object Object].Meteor.methods.zeroMQSend (server/methods.js:10:19)
I20151201-22:41:12.179(2)?     at packages/check/match.js:103:1
I20151201-22:41:12.180(2)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151201-22:41:12.180(2)?     at Object.Match._failIfArgumentsAreNotAllChecked (packages/check/match.js:102:1)
I20151201-22:41:12.181(2)?     at maybeAuditArgumentChecks (livedata_server.js:1695:18)
I20151201-22:41:12.181(2)?     at livedata_server.js:708:19
I20151201-22:41:12.181(2)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151201-22:41:12.181(2)?     at livedata_server.js:706:40
I20151201-22:41:12.182(2)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20151201-22:41:12.182(2)?     at livedata_server.js:704:46
 
    