How do I require a module using node from the command line?
<p>I'm using Mac OSX. I've installed node via Homebrew. I've installed my library (<a href="http://momentjs.com/" rel="noreferrer">MomentJS</a>) via <code>npm install -g moment</code>.</p>

<p>When I type <code>node</code> in the command line, I get the NodeJS console, it looks like:</p>

<blockquote>
  <p>></p>
</blockquote>

<p>Now, let's say I want to use the <code>moment</code> library. If I type:</p>

<pre><code>var moment = require('moment');
</code></pre>

<p>I get the following error:</p>

<blockquote>
  <p>Error: Cannot find module 'moment'</p>
</blockquote>

<p>How might I configure and <code>require</code> an external library using Node from the command line?</p>