title: Using browserify for node.js request package
body: <p>I want to browserify a very simple example with using the node.js request package. Here the <code>http.test.js</code> file:</p>
  
  <pre><code>var request = require('request');
  
  function getDataFromService() {
      request('http://www.google.com', function (error, response, body) {
          console.log('error:', error); 
          console.log('statusCode:', response &amp;&amp; response.statusCode);
          console.log('body:', body);
      });
  }
  </code></pre>
  
  <p>Then I run browserify as follows:</p>
  
  <p><code>browserify http.test.js -o bundle.js</code></p>
  
  <p>The <code>index.html</code> looks like</p>
  
  <pre><code>&lt;html&gt;
      &lt;script src="bundle.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          getDataFromService();
      &lt;/script&gt;
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Running <code>index.html</code> in my browser I get the following error:</p>
  
  <p><em>Uncaught ReferenceError: getDataFromService is not defined</em></p>
  
  <p>So, what's wrong with it?</p>