title: How does "npm" run "npm test"?
body: <p>I always thought that <code>npm test</code> command just launches what I would write in <code>package.json</code> inside <code>scripts: { test: ...}</code> section. But I have this weird bug when it doesn't work.</p>
  
  <p>So, I have this piece of config in <code>package.json</code></p>
  
  <pre><code>"scripts": {
    "start": "node index.js",
    "test": "mocha tests/spec.js"
  }
  </code></pre>
  
  <p>When I try to run tests I type <code>npm test</code> in terminal and had this error:</p>
  
  <pre><code>module.js:340
      throw err;
            ^
  Error: Cannot find module 'commander'
  </code></pre>
  
  <p>But everything is OK when I type just <code>mocha tests/spec.js</code>. Any ideas why is that?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I've tried to install commander and I had an error <strong>Cannot find module 'glob'</strong>. After installing <code>glob</code> I have</p>
  
  <blockquote>
    <p>Error: Cannot find module '../'**</p>
  </blockquote>
  
  <p>But actually question is why do I have these errors and why is everything OK when running <code>mocha tests/spec.js</code>?</p>