我的节点应用程序在我的macbook上工作正常,但是当我在Rackspace上发布到我们的服务器时,我得到以下错误,这是我以前从未见过的(敏感路径被[...]替换):
[...]/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)
答案 0 :(得分:0)
需要编译Contextify来创建.node二进制文件。这些预先构建了jsdom。它在我的Mac上工作正常,但不是在我发布的ubuntu服务器上。根据github页面上的说明在服务器上重建上下文为我解决了问题。