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

express, node.js, requirejs

Solution

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

Problem

Running node.js v0.10.2 and express v3.1.1 (latest at this time) and getting this error: ``` /root/dmr-addresses/node_modules/jquery/lib/node-jquery.js:10 window.XMLHttpRequest.prototype.withCredentials = false; ^ TypeError: Cannot read property 'prototype' of undefined at create (/root/dmr-addresses/node_modules/jquery/lib/node-jquery.js:10:26) at /root/dmr-addresses/node_modules/jquery/lib/node-jquery.js:9503:18 at Object.<anonymous> (/root/dmr-addresses/node_modules/jquery/lib/node-jquery.js:9505:2) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17) at require (module.js:378:17) at Object.<anonymous> (/root/dmr-addresses/address/log.js:1:71) ``` line 1 of log.js is: ``` var $ = require('jquery'); ``` I've tried running `npm install jquery` but it has not fixed the problem.

Original source

Related problems