Question

I have a node.js project that runs fine on Pc and Linux however when running on a Mac (Mountain Lion) the jQuery module doesn't work. any assignment to a property of the window object is ignored.

That is

if(jQuery){
   window.jQuery = jQuery;
   if(!window.jQuery){
       throw "assignment didn't have any effect";
   }
}

will throw an exception. Any ideas to solve it will be appreciated

THe prototype of the object is undefined I would expect those two things to be related. The window object is created using jsdom.createWindow() (which in turn returns doc.parentWindow)

it would seem that it's caused by the line below

vm.runInContext('this', context);

which returns the actual object (with no prototype).

Était-ce utile?

La solution

THe problem is a side effect of not being able to compile contextify while installing the jsdom module. This can be fixed by installing make. The conde in the question that fails is error handling that tries to handle the installation problem of contextify.

installing make on a make can be done be installing development tools (Commandline tools for XCode for OSX ). After installing make then reinstall contextify

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top