Question

My node application works fine on my macbook, but when I publish to our servers on Rackspace I get the following error which I've never seen before (sensitive paths replaced with [...]):

[...]/node_modules/jsdom/node_modules/contextify/lib/contextify.js:7
    var ctx = new ContextifyContext(sandbox);
              ^
TypeError: undefined is not a function
    at Contextify ([...]/node_modules/jsdom/node_modules/contextify/lib/contextify.js:7:15)
    at Object.createWindow ([...]/node_modules/jsdom/lib/jsdom/browser/index.js:303:3)
    at Object.windowAugmentation ([...]/node_modules/jsdom/lib/jsdom/browser/index.js:63:24)
    at Object.parentWindow ([...]/node_modules/jsdom/lib/jsdom/browser/index.js:605:28)
    at Object.<anonymous> ([...]/node_modules/jsdom/lib/jsdom.js:81:15)
    at [...]/node_modules/jsdom/lib/jsdom.js:170:52
    at Request._callback ([...]/node_modules/jsdom/lib/jsdom.js:275:9)
    at Request.callback ([...]/node_modules/request/node_modules/request/main.js:119:22)
    at Request.<anonymous> ([...]/node_modules/request/node_modules/request/main.js:525:16)
    at Request.emit (events.js:67:17)
Was it helpful?

Solution

Contextify needs to be compiled to create .node binaries. These come prebuilt with jsdom. It worked fine on my mac, but not on the ubuntu server I was publishing to. Rebuilding contextify on the server according to the instructions on the github page fixed the problem for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top