I have a few related questions about node-gd and Meteor.
First couple of questions. I've tried to install node-gd in what I believe is the correct place.
Does this look like I've installed it to the correct location for use with Meteor?
Should I be worried about the warnings in the output?
me@ubuntu:/usr/local/lib$ sudo npm install node-gd
npm http GET https://registry.npmjs.org/node-gd
npm http 304 https://registry.npmjs.org/node-gd
> node-gd@0.2.3 install /usr/local/lib/node_modules/node-gd
> node-gyp rebuild
make: Entering directory `/usr/local/lib/node_modules/node-gd/build'
CXX(target) Release/obj.target/node_gd/cpp/node-gd.o
../cpp/node-gd.cpp: In static member function ‘static v8::Handle<v8::Value> Gd::Image::StringFTBBox(const v8::Arguments&)’:
../cpp/node-gd.cpp:1045:22: warning: variable ‘color’ set but not used [-Wunused-but-set-variable]
REQ_INT_ARG(0, color);
^
../cpp/node-gd.cpp:41:7: note: in definition of macro ‘REQ_INT_ARG’
int VAR; \
^
SOLINK_MODULE(target) Release/obj.target/node_gd.node
SOLINK_MODULE(target) Release/obj.target/node_gd.node: Finished
COPY Release/node_gd.node
make: Leaving directory `/usr/local/lib/node_modules/node-gd/build'
node-gd@0.2.3 node_modules/node-gd
me@ubuntu:/usr/local/lib$ ls
node_modules python2.7 python3.4
me@ubuntu:/usr/local/lib$ cd node_modules/
me@ubuntu:/usr/local/lib/node_modules$ ls
meteorite node-gd
I am passing coordinates back to the server and I want to use node-gd to manipulate an image on the server.
This is my Meteor method:
Meteor.methods({
createImage: function(coords) {
console.log('createImage')
console.log(coords.x);
var gd = require('gd');
}
});
When I try to run this function I get this on my terminal:
I20140826-06:44:18.166(-7)? Exception while invoking method 'createImage' ReferenceError: require is not defined
I20140826-06:44:18.166(-7)? at Meteor.methods.createImage (app/server/server.js:7:15)
I20140826-06:44:18.167(-7)? at maybeAuditArgumentChecks (packages/livedata/livedata_server.js:1487)
I20140826-06:44:18.167(-7)? at packages/livedata/livedata_server.js:643
I20140826-06:44:18.168(-7)? at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
I20140826-06:44:18.168(-7)? at packages/livedata/livedata_server.js:642
I20140826-06:44:18.168(-7)? at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
I20140826-06:44:18.168(-7)? at _.extend.protocol_handlers.method (packages/livedata/livedata_server.js:641)
I20140826-06:44:18.168(-7)? at packages/livedata/livedata_server.js:541
The answer to this question suggests various JS solutions. Is this what I need, can anyone recommend what's best to use for Meteor for both server and client?