title: Node.js - check if module is installed without actually requiring it
body: <p>I need to check whether "mocha" is installed, before running it. I came up with the following code:</p>
  
  <pre><code>try {
      var mocha = require("mocha");
  } catch(e) {
      console.error(e.message);
      console.error("Mocha is probably not found. Try running `npm install mocha`.");
      process.exit(e.code);
  }
  </code></pre>
  
  <p>I dont like the idea to catch an exception. Is there a better way?</p>