ecdeveloper/node-web-crawler

Cannot read property 'implementation' of undefined

Closed this issue · 9 comments

I get the below error now:
G:\nodejs\node-web-crawler\node_modules\jsdom\lib\jsdom.js:178
features = JSON.parse(JSON.stringify(window.document.implementation._fea
^
TypeError: Cannot read property 'implementation' of undefined
at exports.env.exports.jsdom.env.processHTML (G:\nodejs\node-web-crawler\nod
e_modules\jsdom\lib\jsdom.js:178:59)
at Object.exports.env.exports.jsdom.env (G:\nodejs\node-web-crawler\node_mod
ules\jsdom\lib\jsdom.js:269:5)
at LinksCheckModel.findOne.doc.remove.urlObj (G:\nodejs\node-web-crawler\cra
wling-daemon.js:216:11)
at IncomingMessage. (G:\nodejs\node-web-crawler\crawling-daemon.j
s:320:4)
at IncomingMessage.EventEmitter.emit (events.js:123:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at Socket.socketOnData as ondata
at TCP.onread (net.js:403:27)

Hi Peter, I faced the same issue...
I've resolved it in this way:
jsdom/jsdom#436 (comment)

Upgrading Python to 2.7.3. After that, install jsdom again and restart.

Hope this helps

Hi mhhansen,
I have Python 2.7.3 installed on my system

Which version of nodeJS are you running ?
If you run python --version, it throws 2.7.3? (sometimes you install lastest python but it's not active yet).
Which OS are you using?

I'm under MacOSx..
After having that error, I've upgraded my nodeJS version to latest, upgrade Python to 2.7.3, restart, check that it's 2.7.3 were the default version, check if I've got the last version of node-web-crawler, reinstall jsdom.
jsdom/jsdom#436 (comment)

This are my versions:


node-web-crawler$ node -v
v0.8.21

node-web-crawler$ npm ls
├── ejs@0.7.2
├── express@3.1.0
├── express-partials@0.0.6
├─┬ jsdom@0.3.4
│ ├── contextify@0.1.4
│ │ └── bindings@1.0.0
├── mongoose@3.1.2
├── named-argv@0.1.0


I am using windows 7 os
python --version it shows
python 2.7.3

nodejs version
v0.8.11

node-web-scraper@0.0.1 G:\nodejs\node-web-crawler
+-- ejs@0.7.2
+-- express@3.1.0
¦ +-- buffer-crc32@0.1.1
¦ +-- commander@0.6.1
¦ +-- connect@2.7.2
¦ ¦ +-- bytes@0.1.0
¦ ¦ +-- formidable@1.0.11
¦ ¦ +-- pause@0.0.1
¦ ¦ +-- qs@0.5.1
¦ +-- cookie@0.0.5
¦ +-- cookie-signature@0.0.1
¦ +-- debug@0.7.2
¦ +-- fresh@0.1.0
¦ +-- methods@0.0.1
¦ +-- mkdirp@0.3.3
¦ +-- range-parser@0.0.4
¦ +-- send@0.1.0
¦ +-- mime@1.2.6
+-- express-partials@0.0.6
+-- jsdom@0.3.4
¦ +-- cssom@0.2.5
¦ +-- cssstyle@0.2.3
¦ +-- htmlparser@1.7.6
¦ +-- nwmatcher@1.3.1
¦ +-- request@2.14.0
¦ +-- form-data@0.0.7
¦ ¦ +-- async@0.1.22
¦ ¦ +-- combined-stream@0.0.4
¦ ¦ +-- delayed-stream@0.0.5
¦ +-- mime@1.2.9
+-- mongoose@3.1.2
¦ +-- hooks@0.2.1
¦ +-- mongodb@1.1.7
¦ ¦ +-- bson@0.1.3
¦ +-- ms@0.1.0
+-- named-argv@0.1.0
+-- socket.io@0.9.13
+-- base64id@0.1.0
+-- policyfile@0.0.4
+-- redis@0.7.3
+-- socket.io-client@0.9.11
+-- active-x-obfuscator@0.0.1
¦ +-- zeparser@0.0.5
+-- uglify-js@1.2.5
+-- ws@0.4.25
¦ +-- commander@0.6.1
¦ +-- options@0.0.3
¦ +-- tinycolor@0.0.1
+-- xmlhttprequest@1.4.2

You actually have latest version of jsdom, but it doesn't show Contextify as a dependency.
Which is odd, since JSDom has that dependency. But I'm not sure how npm shows dependencies under Window OS, maybe is installed but not listed there (you could check jsdom/node_modules/ if contextify is there)...

Take a look at the bottom of the jsdom npm's home page, section about using Contextify under Windows: https://npmjs.org/package/jsdom

Another possible reason could be what's missing in your environment is Visual Studio 2010 Express.
http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/

Upgrading your nodejs to latest stable version should be useful to, which is v0.8.22.-
(it was launched a couple of hours ago)

peterbarretto, have you solved the issue? have you tried to update Node?

I upgraded to node v0.8.22 but i still get the same error.
i dont have the contextify folder inside jsdom/node_modules/

Installed visual C++ 2010 express and now the crawling works. Thanks.