title: Add .js script file for Cloud Foundry deployment
body: <p>I have some node.js code using <code>jsdom</code> and I need <code>jquery.min.js</code> file for backend css selector stuffs. Things ran fine locally but if I deploy using <code>vmc push</code> on <code>api.cloudfoundry.com</code>, it gave me <strong>502 Bad Gateway nginx</strong></p>
  
  <p>I assume I have to declare all dependencies in package.json like here <a href="http://blog.nodejitsu.com/package-dependencies-done-right" rel="nofollow">http://blog.nodejitsu.com/package-dependencies-done-right</a></p>
  
  <p>However, I don't know how to include <code>jquery.min.js</code>. Right now it is in <code>/lib</code> folder and not <code>/node_modules</code> folder (because it's not a node module).</p>
  
  <p>Can someone help me on how to include the right dependencies and other extra .js files for Cloud Foundry?</p>
  
  <p><strong>UPDATE 1:</strong> </p>
  
  <p>Here is my code after removing bunch of things. If I commenting out the <code>jsdom.env</code>, there is no error.</p>
  
  <pre><code>var port = (process.env.VMC_APP_PORT || 3000);
  var host = (process.env.VCAP_APP_HOST || 'localhost');
  var http = require('http');
  
  var request = require('request'),
      jsdom = require('jsdom');
  
  http.createServer(function (req, res) {
    request({ uri:'http://www.google.com' }, function (error, response, body) {
      if (error &amp;&amp; response.statusCode !== 200) {
        console.log('Error when contacting the url')
      }
  
      jsdom.env({
        html: body,
        scripts: [
          'lib/jquery.min.js'
        ]
      }, function (err, window) {
      });
  
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.write(body);
      res.end('\n');
  
    });
  
  }).listen(port, host);
  </code></pre>
  
  <p>Here are what I saw when using <code>vmc logs hp-myapp</code></p>
  
  <pre><code>Using manifest file manifest.yml
  
  Getting logs for hp-myapp #0... OK
  
  Reading logs/staging.log... OK
  [2012-12-18 03:06:27] Setting up temporary directories
  [2012-12-18 03:06:27] Downloading application
  [2012-12-18 03:06:27] Unpacking application
  [2012-12-18 03:06:27] Staging application
  [2012-12-18 03:06:28] # Logfile created on 2012-12-18 03:06:28 +0000 by logger.r
  b/25413
  [2012-12-18 03:06:28] Skipping npm support: npm-shrinkwrap.json is not provided
  [2012-12-18 03:06:28] Creating droplet
  [2012-12-18 03:06:29] Uploading droplet
  [2012-12-18 03:06:30] Done!
  
  Reading logs/stderr.log... OK
  
  /var/vcap/data/dea/apps/hp-myapp-0-5bda6049e33af03b32b79777356c8d63/app/node_mod
  ules/jsdom/lib/jsdom.js:178
      features   = JSON.parse(JSON.stringify(window.document.implementation._fea
                                                            ^
  TypeError: Cannot read property 'implementation' of undefined
      at exports.env.exports.jsdom.env.processHTML (/var/vcap/data/dea/apps/hp-myapp-0-5bda6049e33af03b32b79777356c8d63/app/node_modules/jsdom/lib/jsdom.js:178:59
  )
      at Object.exports.env.exports.jsdom.env (/var/vcap/data/dea/apps/hp-myapp-0-
  5bda6049e33af03b32b79777356c8d63/app/node_modules/jsdom/lib/jsdom.js:269:5)
      at Request._callback (/var/vcap/data/dea/apps/hp-myapp-0-5bda6049e33af03b32b
  79777356c8d63/app/app.js:23:9)
      at Request.init.self.callback (/var/vcap/data/dea/apps/hp-myapp-0-5bda6049e3
  3af03b32b79777356c8d63/app/node_modules/request/main.js:122:22)
      at Request.EventEmitter.emit (events.js:91:17)
      at Request.&lt;anonymous&gt; (/var/vcap/data/dea/apps/hp-myapp-0-5bda6049e33af03b3
  2b79777356c8d63/app/node_modules/request/main.js:661:16)
      at Request.EventEmitter.emit (events.js:115:20)
      at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (/v
  ar/vcap/data/dea/apps/hp-myapp-0-5bda6049e33af03b32b79777356c8d63/app/node_modul
  es/request/main.js:623:14)
      at IncomingMessage.EventEmitter.emit (events.js:115:20)
      at IncomingMessage._emitEnd (http.js:366:10)
  
  Reading logs/stdout.log... OK
  </code></pre>
  
  <p>It can't be contextify because my <code>localhost:3000</code> ran just fine <a href="https://github.com/tmpvar/jsdom/issues/436" rel="nofollow">https://github.com/tmpvar/jsdom/issues/436</a></p>