How to diagnores error "cannot read property 'implementation' of undefined"?

378 views
Skip to first unread message

corey kennedy

unread,
Feb 7, 2013, 8:07:14 PM2/7/13
to js...@googlegroups.com
Greetings all,

I've just started trying to use jsdom, but whenever I attempt to read in a document from a URL, an exception is thrown with the error "Cannot read property 'implementation' of undefined'.  I've pasted the stack trace and my source code below my message.

I've just built node, so I'm on v0.9.10-pre.  The package.json for jsdom indicates version '0.4.0'.

In the code below, I'm trying to scrape www.google.com.  I've also tried slashdot.org, to no avail.

Can anyone point in the right direction for resolving this?

-- Stack Trace --
TypeError: Cannot read property 'implementation' of undefined
    at processHTML (/home/nate/projects/scraper/node_modules/jsdom/lib/jsdom.js:178:59)
    at Request._callback (/home/nate/projects/scraper/node_modules/jsdom/lib/jsdom.js:283:9)
    at Request.self.callback (/home/nate/projects/scraper/node_modules/jsdom/node_modules/request/main.js:122:22)
    at Request.EventEmitter.emit (events.js:97:17)
    at Request.<anonymous> (/home/nate/projects/scraper/node_modules/jsdom/node_modules/request/main.js:661:16)
    at Request.EventEmitter.emit (events.js:124:20)
    at IncomingMessage.<anonymous> (/home/nate/projects/scraper/node_modules/jsdom/node_modules/request/main.js:623:14)
    at IncomingMessage.EventEmitter.emit (events.js:124:20)
    at _stream_readable.js:806:12
    at process._tickCallback (node.js:427:13)
-----------------------

Source code:
-----------------------
var jsdom = require('jsdom');

jsdom.env({
  done: function(errors, window) {
    if (errors) { console.log(errors); }
    else {
      console.log( window.name );
    }
  }
});
-------------------------------

Domenic Denicola

unread,
Feb 8, 2013, 1:25:10 AM2/8/13
to js...@googlegroups.com

This is due to Contextify not being installed correctly. It is listed as an optionalDependency in package.json, but it’s really not—if it can’t install, you get this error with pretty much everything.

 

When you do the npm install, do you get any errors about the installation of contextify? Does this happen on a stable Node version (i.e. the 0.8 series)?

 

--
You received this message because you are subscribed to the Google Groups "jsdom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsdom+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brian McDaniel

unread,
Feb 8, 2013, 11:16:58 PM2/8/13
to js...@googlegroups.com
Contextify is broken on Node >= 0.9.6 right now, but I will be pushing a new release soon (tomorrow) to fix it.

Domenic - is there a reason not to go back to making Contextify a non-optional dependency?  It seems like having it be optional just causes confusion and trouble.

corey kennedy

unread,
Feb 9, 2013, 5:12:41 PM2/9/13
to js...@googlegroups.com
I reverted to node v0.8.19 and it seems to be working now.  Thanks for the help!

Domenic Denicola

unread,
Feb 9, 2013, 5:16:48 PM2/9/13
to js...@googlegroups.com

I agree that it should be non-optional. Eli, any disagreement? Maybe push out a 0.5 in the next week with that change.

Elijah Insua

unread,
Feb 9, 2013, 6:42:22 PM2/9/13
to js...@googlegroups.com
Nope, this seems to be a pretty big deception on our part.  Along with making it a non-optional dependency, maybe we should also include some help in the readme regarding installing under windows (I'm assuming this is the major failure case)

-- Elijah
Reply all
Reply to author
Forward
0 new messages