wesleyhales / speedgun

http://speedgun.io
88 stars 4 forks source link

TypeError: undefined is not an object (evaluating 'config.userAgentAliases[config.userAgent]') #39

Open bambamx opened 7 years ago

bambamx commented 7 years ago

I tried to run the example that is on the README file and I got this error:

$ phantomjs --config=core/pconfig.json core/speedgun.js http://www.cnn.com -o csv --screenshot
TypeError: undefined is not an object (evaluating 'config.userAgentAliases[config.userAgent]')

  phantomjs://code/speedgun.js:437 in load
  phantomjs://code/speedgun.js:73 in run
bambamx commented 7 years ago

By the looks of it seems like config.userAgentAliases does not exist.. this is the output of the config variable

{
    "task": "performance",
    "format": "simple",
    "output": "csv",
    "userAgent": "chrome",
    "configFile": "config.json",
    "uuid": null,
    "reportLocation": "http_www.cnn.com/speedgun",
    "url": "http://www.cnn.com",
    "screenshot": true,
    "help": false,
    "version": false,
    "verbose": false,
    "crawl": false,
    "debug": false,
    "wipe": false,
    "override": false,
    "akamaiDebug": false,
    "detectReflow": false,
    "phantomCacheEnabled": false
}
bambamx commented 7 years ago

I found a solution, you have to run the command inside the core/ directory looks like if you run it somewhere else the mergeConfig function fails because the configFile property is pointing to 'config.json'

cd core
phantomjs --config=pconfig.json speedgun.js http://www.cnn.com -o csv --screenshot