Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9030351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:28:08+00:00 2026-06-16T07:28:08+00:00

I have some node.js code using jsdom and I need jquery.min.js file for backend

  • 0

I have some node.js code using jsdom and I need jquery.min.js file for backend css selector stuffs. Things ran fine locally but if I deploy using vmc push on api.cloudfoundry.com, it gave me 502 Bad Gateway nginx

I assume I have to declare all dependencies in package.json like here http://blog.nodejitsu.com/package-dependencies-done-right

However, I don’t know how to include jquery.min.js. Right now it is in /lib folder and not /node_modules folder (because it’s not a node module).

Can someone help me on how to include the right dependencies and other extra .js files for Cloud Foundry?

UPDATE 1:

Here is my code after removing bunch of things. If I commenting out the jsdom.env, there is no error.

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 && 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);

Here are what I saw when using vmc logs hp-myapp

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.<anonymous> (/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

It can’t be contextify because my localhost:3000 ran just fine https://github.com/tmpvar/jsdom/issues/436

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:28:09+00:00Added an answer on June 16, 2026 at 7:28 am

    I decided to go with Cheerio

    That one works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery with jsdom (0.2.10). For some reason node.exe (0.6.5.1) never returns when
I have the next code dynamically created using JQuery. Theere are multiple row class
I have some simple code I am using to learn OAuth authentication using the
I have some C++ code for a node.js module that is written for node
I am using the following node.js code to download documents from some url and
I have some simple GWT client code that I would like to test using
I have a treeView , and i want to know if some node can
I have to loop in a JSON array to get some informations in node
For example I have created cluster with 1GB RAM memory per node. After some
I have some data loaded as a np.ndarray and need to convert it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.