我想部署我的node.js服務器聯機。在我的機器一切正常,但網上移動服務器和運行節點時,我得到這個錯誤:jQuery的節點TypeError:需要一個'上下文'參數
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: needs a 'context' argument.
at Object.getGlobal (/my/path/CloudServer/node_modules/jquery/node_modules/jsdom/lib/jsdom/browser/index.js:26:21)
at Object.createWindow (/my/path/CloudServer/node_modules/jquery/node_modules/jsdom/lib/jsdom/browser/index.js:308:23)
at Object.windowAugmentation (/my/path/CloudServer/node_modules/jquery/node_modules/jsdom/lib/jsdom/browser/index.js:63:24)
at Object.parentWindow (/my/path/CloudServer/node_modules/jquery/node_modules/jsdom/lib/jsdom/browser/index.js:605:28)
at Object.<anonymous> (/my/path/CloudServer/node_modules/jquery/node_modules/jsdom/lib/jsdom.js:81:15)
at create (/my/path/CloudServer/node_modules/jquery/node-jquery.js:5:47)
at /my/path/CloudServer/node_modules/jquery/node-jquery.js:9065:18
at Object.<anonymous> (/my/path/CloudServer/node_modules/jquery/node-jquery.js:9067:1)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
現在,我一直在努力遵循堆棧跟蹤,但我不能找出其中的錯誤來自。由於堆棧大部分顯示了jquery for node中的問題,因此我猜問題就在那裏。有誰知道該怎麼辦?
感謝
「醫生,醫生,當我彎曲我的腿時疼痛......」醫生回答:「那麼不要彎曲你的腿」。這是如何回答的?這可能是一個評論,但不是答案。 – 2015-02-26 10:07:32
已經過去了很長一段時間,但我相信我並不需要jQuery for Node,但由於某種原因尚未安裝它。通過刪除它,我沒有刪除任何功能,代碼再次工作。我認爲Trotyl對他的回答是正確的。 – Masiar 2015-03-18 14:34:24