title: Meteor/node-gd & ReferenceError: require is not defined
body: <p>I have a few related questions about node-gd and Meteor.</p>
  
  <p>First couple of questions.  I've tried to install <a href="https://github.com/mikesmullin/node-gd" rel="nofollow noreferrer">node-gd</a> in what I believe is the correct place. </p>
  
  <p>Does this look like I've installed it to the correct location for use with Meteor?</p>
  
  <p>Should I be worried about the warnings in the output?</p>
  
  <pre><code>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
  
  &gt; node-gd@0.2.3 install /usr/local/lib/node_modules/node-gd
  &gt; 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&lt;v8::Value&gt; Gd::Image::StringFTBBox(const v8::Arguments&amp;)’:
  ../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
  </code></pre>
  
  <p>I am passing coordinates back to the server and I want to use node-gd to manipulate an image on the server.</p>
  
  <p>This is my Meteor method:</p>
  
  <pre><code>Meteor.methods({
    createImage: function(coords) {
    console.log('createImage')
    console.log(coords.x);
  
    var gd   = require('gd');
    }
  });
  </code></pre>
  
  <p>When I try to run this function I get this on my terminal:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The answer to <a href="https://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-require-is-not-defined">this question</a> suggests various JS solutions.  Is this what I need, can anyone recommend what's best to use for Meteor for both server and client?</p>