Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't work with jsdom 0.2.0 #4

Closed
gerad opened this issue Mar 8, 2011 · 15 comments
Closed

doesn't work with jsdom 0.2.0 #4

gerad opened this issue Mar 8, 2011 · 15 comments

Comments

@gerad
Copy link

gerad commented Mar 8, 2011

I'm getting issues when trying to run the example app with Node 0.4.0 and JSDom 0.2.0..

Here's the stacktrace

TypeError: Cannot read property 'prototype' of undefined
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/browser/index.js:84:16
    at String.<anonymous> ([object Context]:2500:12)
    at Function.each ([object Context]:692:29)
    at Object.add ([object Context]:2478:10)
    at [object Context]:2907:17
    at Function.each ([object Context]:692:29)
    at Object.each ([object Context]:155:17)
    at Object.one ([object Context]:2906:15)
    at Object.bind ([object Context]:2896:34)
    at [object Context]:3106:18
    at [object Context]:4376:2
    at Object.javascript (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/languages/javascript.js:17:14)
    at Object._eval (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:1195:46)
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:43:20
    at Object.check (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:235:34)
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:251:12
    at [object Object].<anonymous> (fs.js:86:5)
    at [object Object].emit (events.js:39:17)
    at afterRead (fs.js:840:12)
TypeError: undefined is not a function
    at CALL_NON_FUNCTION (native)
    at /usr/local/lib/node/.npm/scraper/0.0.8/package/lib/scraper.js:58:7
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom.js:151:30
    at Object.<anonymous> (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/events.js:274:17)
    at Object.dispatchEvent (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:415:55)
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:56:15
    at Object.check (/usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:235:34)
    at /usr/local/lib/node/.npm/jsdom/0.2.0/package/lib/jsdom/level2/html.js:251:12
    at [object Object].<anonymous> (fs.js:86:5)
    at [object Object].emit (events.js:39:17)
@mape
Copy link
Owner

mape commented Mar 8, 2011

Have you tried it with latest stable?

@gerad
Copy link
Author

gerad commented Mar 8, 2011

Yeah, fails on node 0.4.2 with jsdom 0.2.0... works fine with jsdom 0.1.23.

@mape
Copy link
Owner

mape commented Mar 8, 2011

Is that when using the examples or scraping a different site?

@gerad
Copy link
Author

gerad commented Mar 8, 2011

Just the first simple twitter example in your README.

@gerad
Copy link
Author

gerad commented Mar 8, 2011

Seems like it's probably a JSDOM issue.

@mape
Copy link
Owner

mape commented Mar 8, 2011

I don't have that issue though, but yeah, seems jsdom doesn't want to play.

@jpiulac
Copy link

jpiulac commented Mar 22, 2011

Had the same issue. fixed with change to scraper.js

replaced __dirname+'/../deps/jquery-1.3.2.js'
with 'http://code.jquery.com/jquery-1.4.2.min.js'

seems to be an issue loading the file in jsdom.jQuerify call - path is correct and permissions are fine so not sure what the problem is.

@EvanCarroll EvanCarroll reopened this May 4, 2011
@EvanCarroll
Copy link

This issue isn't solved. I had the same problem with jsdom 0.2.0 , and I solved it with @jma3s suggestion.

$ node --version
v0.4.7

I actually upgrade though to jquery-1.6.0

@sindresorhus
Copy link

Tried @jma3s fix, but still get that error.

TypeError: Cannot read property 'prototype' of undefined
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/browser/index.js:84:16
    at String.<anonymous> ([object Context]:2500:12)
    at Function.each ([object Context]:692:29)
    at Object.add ([object Context]:2478:10)
    at [object Context]:2907:17
    at Function.each ([object Context]:692:29)
    at Object.each ([object Context]:155:17)
    at Object.one ([object Context]:2906:15)
    at Object.bind ([object Context]:2896:34)
    at [object Context]:3106:18
    at [object Context]:4376:2
    at Object.javascript (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/languages/javascript.js:17:14)
    at Object._eval (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:1195:46)
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:43:20
    at Object.check (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:235:11)
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:251:12
    at [object Object].<anonymous> (fs.js:107:5)
    at [object Object].emit (events.js:61:17)
    at afterRead (fs.js:878:12)
    at wrapper (fs.js:245:17)
TypeError: undefined is not a function
    at CALL_NON_FUNCTION (native)
    at /Users/mofle/node_modules/scraper/lib/scraper.js:58:7
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom.js:151:7
    at Object.<anonymous> (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/events.js:274:17)
    at Object.dispatchEvent (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:415:55)
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:56:15
    at Object.check (/Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:235:11)
    at /Users/mofle/node_modules/scraper/node_modules/jsdom/lib/jsdom/level2/html.js:251:12
    at [object Object].<anonymous> (fs.js:107:5)
    at [object Object].emit (events.js:61:17)

@dkordik
Copy link

dkordik commented May 26, 2011

Mine was fixed by updating jQuery ala @jma3s. I used 1.6.1.

@EvanCarroll
Copy link

@mape could we get this patched with @jma3s's suggestion and the latest version of jQuery?

@mape
Copy link
Owner

mape commented May 30, 2011

The scraper is now updated to use jQuery 1.6.1 and is pushed to npm.

@mofle Do you get that error with all pages? And are you using latest jsdom?

@muloka
Copy link

muloka commented May 31, 2011

There is also an issue with jsdom 0.2.0 which has been fixed in 0.2.1 though it has not been yet pushed to npm. Also line 57 of scrape.js is still referring to jQuery 1.3.2.

After switching it to the supplied 1.6.1 library and changing the require statement to point to jsdom@0.2.1, scraper is working as expected.

p.s.: I'm currently using node v0.5.0-pre.

@mape
Copy link
Owner

mape commented May 31, 2011

Silly me, pushed update that uses jQuery 1.61.

@EyePulp
Copy link

EyePulp commented Jul 13, 2011

I did a manual uninstall of jsdom via npm: npm uninstall jsdom from within the scraper directory project/node_modules/scraper

and then ran this:
npm install https://github.com/tmpvar/jsdom/tarball/4cf155a1624b3fb54b2eec536a0c060ec1bab4ab
out at the upper level project/ - it seems to have fixed it also. (it has the jsdom 0.2.1 fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants