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

undefined is not an object (evaluating 'args.length') #129

Open
vinnitu opened this issue Dec 3, 2014 · 15 comments
Open

undefined is not an object (evaluating 'args.length') #129

vinnitu opened this issue Dec 3, 2014 · 15 comments

Comments

@vinnitu
Copy link

vinnitu commented Dec 3, 2014

for phantomjs 2.0.0dev

phantomjs yslow.js --help

output is

TypeError: undefined is not an object (evaluating 'args.length')

  yslow.js:5 in global code
@lewsid
Copy link

lewsid commented Jan 29, 2015

Seeing the same thing, using PhantomJS 2.0. Looks like yslow can no longer access the phantomJS arguments.

@lewsid
Copy link

lewsid commented Jan 29, 2015

Digging in a little, and found that 'phantom.args' is deprecated in v2 (http://phantomjs.org/api/phantom/property/args.html). I tried updating the relevant code to use the newer 'system.args' call and it no longer throws an error, but it also no longer finishes.

screen shot 2015-01-29 at 10 11 18 am

Bummer. Looks like I'll have to dig a little deeper.

@soulgalore
Copy link
Contributor

yep, the phantom.args has been removed in 2.0, I've changed that in https://github.com/sitespeedio/yslow/blob/master/src/phantomjs/controller.js using system.args instead (thanks @thebostik for showing me). You can cherry pick the fix from there.

@soulgalore
Copy link
Contributor

@lewsid the first argument in system.args is the script name so you need to adjust the arguments, then it will work.

@lewsid
Copy link

lewsid commented Jan 29, 2015

Thanks for the info @soulgalore! I've applied your fix, and rearranged my arguments, but it still hangs. My command looks like this:

/usr/bin/phantomjs_2.0 /path/to/patched_yslow.js --ssl-protocol=any --info basic http://example.com

Can you spot anything that I'm doing obviously wrong here?

@soulgalore
Copy link
Contributor

@lewsid if you could share your branch, then I can try it out, and then you can make a PR so it's fixed in YSlow?

@jpkeisala
Copy link

@lewsid Did you manage to to get yslow working? I am also looking the fix for this.

@lewsid
Copy link

lewsid commented Mar 31, 2015

@jpkeisala Unfortunately, no. Sorry to leave you and others hanging without my code for reference. I made some progress but eventually abandoned the effort and just nixed yslow from the project.

@soulgalore
Copy link
Contributor

I can make the PR tonight then, np.

@abcfy2
Copy link

abcfy2 commented Feb 25, 2016

Did this issue fix for now? I'm facing the same issue.

I'm using the latest phantomjs(as of 2.1.1), yslow from http://yslow.org/yslow-phantomjs-3.1.8.zip, and raise an error:

TypeError: undefined is not an object (evaluating 'args.length')

  phantomjs://code/yslow.js:5 in global code

@soulgalore
Copy link
Contributor

@abcfy2 you can use this PR to fix it.

@abcfy2
Copy link

abcfy2 commented Feb 26, 2016

@soulgalore Thanks, it works.

But do you know how to use yslow for login pages ? I know phantomjs can work as a real browser, but I don't know how to implement.

hofan41 pushed a commit to hofan41/yslow that referenced this issue Mar 29, 2016
removed deprecated args to work with phantomjs 2 marcelduran#129
legendtang pushed a commit to legendtang/yslow that referenced this issue Sep 5, 2016
ygally pushed a commit to ygally/yslow that referenced this issue Oct 28, 2016
@Muthulakshmirp
Copy link

I'm facing the same issue as well with version 3.1.8

Could anyone help?

TypeError: undefined is not an object (evaluating 'args.length')

phantomjs://code/yslow.js:5 in global code

@paramesh
Copy link

To make it much simpler to follow just do the following.

1.) Open yslow.js file under yslow-phantomjs-3.1.8
2.) Replace the following line
var i,arg,page,urlCount,viewport,webpage=require("webpage"),args=phantom.args,
with
var i,arg,page,urlCount,viewport,webpage=require("webpage"),system = require('system'),args=system.args,

The above works for me.

@davidfavor
Copy link

davidfavor commented Jan 5, 2019

Problem still exists in yslow-phantomjs-3.1.8 + the above fix is difficult because yslow.js seem obfuscated.

Be great if this problem could be fixed.

Also, fix show above does not work.

Changes the error to...

TypeError: undefined is not an object (evaluating 'args.length')

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