Node.js with ExpressJS error: Cannot read property 'prototype' of undefined Node.js with ExpressJS error: Cannot read property 'prototype' of undefined express express

Node.js with ExpressJS error: Cannot read property 'prototype' of undefined


Check this:

Same error here...I don't know what I'm doing, but I changed the node-jquery.js fourth-fifth row's and it's start working :)

old:

if(window == null ) {    window = require('jsdom').jsdom().createWindow();

new:

if(!window || !window.document) {    window = require('jsdom').createWindow();    window.document = require('jsdom').jsdom();


You don't actually have a prototype object in Node server code, it's all stored in the much nicer __proto__ object and you should be using Object.create/defineProperty.

What exactly are you trying to do? Run an ajax query with Node? If so, you should be using Nodes http.request

An example could be:

require('request').post({    "uri"     : "http://example.com/",    "headers" : {        'content-type': 'application/json'    },    "body"    : "hello=world"},function(e,r,b){    // e = errors, r = response and b = returned body    console.log(b,r.statusCode));});


Looks like this is an issue with the jsdom module that node-jquery depends on. It appears that this is a known issue, and that it has been fixed, but not published to npm yet.

Check it out: https://github.com/coolaj86/node-jquery/issues/52