phantomas icon indicating copy to clipboard operation
phantomas copied to clipboard

Failed to parse JSON with the results

Open jatin85 opened this issue 7 years ago • 5 comments

Please find below output in debug mode. "DEBUG=* phantomas "http://google.com" --verbose optimist:config parse: ["/home/opc/.nvm/versions/node/v13.2.0/bin/node","/home/opc/.nvm/versions/node/v13.2.0/bin/phantomas","http://google.com","--verbose"] +0ms optimist:config options: {"":["/home/opc/.nvm/versions/node/v13.2.0/bin/node","/home/opc/.nvm/versions/node/v13.2.0/bin/phantomas","http://google.com"],"version":false,"V":false,"help":false,"h":false,"verbose":true,"v":true,"disable-js":false,"no-externals":false,"scroll":false,"spy-eval":false,"stop-at-onload":false,"analyze-css":false,"colors":false,"film-strip":false,"page-source":false,"progress":false,"silent":false,"ssl-protocol":"any","timeout":15,"reporter":"plain","R":"plain","format":"plain","$0":"phantomas"} +2ms phantomas:cli Preparing 1 run(s)... +0ms phantomas nodejs v13.2.0 +0ms phantomas phantomas v1.20.1 installed in /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas +0ms phantomas URL: http://google.com +1ms phantomas Options: {"version":false,"V":false,"help":false,"h":false,"verbose":true,"v":true,"disable-js":false,"no-externals":false,"scroll":false,"spy-eval":false,"stop-at-onload":false,"analyze-css":false,"colors":false,"film-strip":false,"page-source":false,"progress":false,"silent":false,"ssl-protocol":"any","timeout":15,"reporter":"plain","R":"plain","format":"plain"} +0ms phantomas Environment: {"DEBUG":"","XDG_SESSION_ID":"28138","HOSTNAME":"ministress-fra1","SELINUX_ROLE_REQUESTED":"","NVM_CD_FLAGS":"","TERM":"xterm","SHELL":"/bin/bash","HISTSIZE":"1000","SSH_CLIENT":"138.3.193.241 51031 22","SELINUX_USE_CURRENT_RANGE":"","OLDPWD":"/home/opc/test","SSH_TTY":"/dev/pts/0","NVM_DIR":"/home/opc/.nvm","USER":"opc","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=01;36:.au=01;36:.flac=01;36:.mid=01;36:.midi=01;36:.mka=01;36:.mp3=01;36:.mpc=01;36:.ogg=01;36:.ra=01;36:.wav=01;36:.axa=01;36:.oga=01;36:.spx=01;36:.xspf=01;36:","MAIL":"/var/spool/mail/opc","PATH":"/home/opc/.nvm/versions/node/v13.2.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/opc/.local/bin:/home/opc/bin","PWD":"/home/opc","LANG":"en_US.UTF-8","SELINUX_LEVEL_REQUESTED":"","HISTCONTROL":"ignoredups","SHLVL":"1","HOME":"/home/opc","LOGNAME":"opc","SSH_CONNECTION":"138.3.193.241 51031 10.0.0.2 22","NVM_BIN":"/home/opc/.nvm/versions/node/v13.2.0/bin","LESSOPEN":"||/usr/bin/lesspipe.sh %s","XDG_RUNTIME_DIR":"/run/user/1000","":"/home/opc/.nvm/versions/node/v13.2.0/bin/phantomas","PHANTOMAS_TMP_DIR":"/tmp/phantomas/7e79a39a-797a-49ed-a643-8bb31ef48523/","ANALYZE_CSS_BIN":"/home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/node_modules/analyze-css/bin/analyze-css.js"} +28ms phantomas:engines Engine "webkit": PhantomJS v2.5.0-development installed in /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomjs-prebuilt-macbre/lib/phantom/bin/phantomjs +0ms phantomas:engines Engine "gecko": failed to import - Error: Cannot find module 'slimerjs' Require stack:

  • /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/lib/engines/gecko.js
  • /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/lib/engines.js
  • /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/lib/index.js
  • /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/bin/phantomas.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17) at Function.Module._load (internal/modules/cjs/loader.js:847:27) at Module.require (internal/modules/cjs/loader.js:1016:19) at require (internal/modules/cjs/helpers.js:69:18) at Object. (/home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/lib/engines/gecko.js:4:11) at Module._compile (internal/modules/cjs/loader.js:1121:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10) at Module.load (internal/modules/cjs/loader.js:976:32) at Function.Module._load (internal/modules/cjs/loader.js:884:14) at Module.require (internal/modules/cjs/loader.js:1016:19) { code: 'MODULE_NOT_FOUND', requireStack: [Array] } +3ms phantomas:engines Running /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/scripts/phantomas.js (using PhantomJS) +2ms phantomas:engines Passing phantomas options: {"format":"plain","R":"plain","reporter":"plain","timeout":15,"ssl-protocol":"any","debug":"false","silent":false,"progress":false,"page-source":false,"film-strip":false,"colors":false,"analyze-css":false,"stop-at-onload":false,"spy-eval":false,"scroll":false,"no-externals":false,"disable-js":false,"v":true,"verbose":true,"h":false,"help":false,"V":false,"version":false,"url":"http://google.com","user-agent":"phantomas/1.20.1 (PhantomJS/2.5.0-development; linux x64)"} +0ms phantomas:engines Passing engine options: ["--local-storage-quota=5000","--ssl-protocol=any","--debug=false"] +0ms phantomas Spawned with pid #20257 +15ms Debug: /home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomjs-prebuilt-macbre/lib/phantom/bin/phantomjs: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory phantomas:results Process returned code #127 +0ms phantomas:results Error when parsing JSON (SyntaxError: Unexpected end of JSON input at JSON.parse () at ChildProcess. (/home/opc/.nvm/versions/node/v13.2.0/lib/node_modules/phantomas/lib/index.js:172:16) at ChildProcess.emit (events.js:210:5) at maybeClose (internal/child_process.js:1023:16) at Socket. (internal/child_process.js:438:11) at Socket.emit (events.js:210:5) at Pipe. (net.js:664:12)): "" +0ms phantomas: (255) Failed to parse JSON with the results phantomas:runs results [1]: [[{},null]] +0ms phantomas:runs Run #1 did not complete - err #255 +0ms phantomas:runs err: "255" +1ms phantomas:runs Exiting with code #255 +0ms "

jatin85 avatar Nov 26 '19 07:11 jatin85

The same for me, nor via nodejs script, neither via command line interface. Example of error given after CLI run: phantomas: (255) Failed to parse JSON with the results

What would produce the problem?

shervud avatar Jan 08 '20 13:01 shervud

Same problem for me!

dobleme avatar Aug 12 '20 16:08 dobleme

@dobleme, @shervud, @jatin85 - can you guys try to reproduce the same issue using the last phantomas (from v2 branch)?

It works fine for me now:

DEBUG=* ./bin/phantomas.js "http://google.com" --verbose --pretty
...
{
  "generator": "phantomas v2.0.0-alpha1",
  "url": "http://google.com",
  "metrics": {
    "requests": 8,
    "gzipRequests": 2,
    "postRequests": 0,
    "httpsRequests": 0,
    "notFound": 0,

macbre avatar Aug 12 '20 21:08 macbre

@macbre In my case totally my fault. I installed v2.0.0-alpha1 but I was using v1.20.1 from old installation I had. Test it now from the v2 branch and from npm package and it is working fine.

Sorry to waste your time.

dobleme avatar Aug 24 '20 09:08 dobleme

@dobleme , no worries :wink: Thanks for letting me know. I'm closing this report.

macbre avatar Aug 24 '20 10:08 macbre