Intermittent phantomjs error during build

Some builds fail because of an error with phantomjs, checking this blog I change the circle config to install newest version but the error still happening.
When I get this error I just need to rebuild and everithing works well again (without any code change)
info:

  • Rails 4.2
  • Ruby 2.3
# circle.yml
machine:
  pre:
    - sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1
# Error log
bundle exec rake jasmine:ci
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:57687, CTRL+C to stop
Waiting for jasmine server on 57687...
jasmine server started
Phantomjs does not appear to be installed in /home/ubuntu/.phantomjs/1.9.8/x86_64-linux/bin/phantomjs, installing!
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0   333    0     0   6540      0 --:--:-- --:--:-- --:--:--  6540
bunzip2: phantomjs-1.9.8-linux-x86_64.tar.bz2 is not a bzip2 file.
tar: phantomjs-1.9.8-linux-x86_64.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
rake aborted!
TypeError: no implicit conversion of nil into String
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs/platform.rb:72:in `block in install!'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs/platform.rb:53:in `chdir'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs/platform.rb:53:in `install!'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs/platform.rb:86:in `ensure_installed!'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs.rb:30:in `platform'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/phantomjs-1.9.8.0/lib/phantomjs.rb:25:in `path'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/jasmine-2.3.0/lib/jasmine/runners/phantom_js.rb:51:in `phantom_js_path'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/jasmine-2.3.0/lib/jasmine/runners/phantom_js.rb:17:in `run'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/jasmine-2.3.0/lib/jasmine/ci_runner.rb:35:in `run'
/home/ubuntu/Health-eFilings/vendor/bundle/ruby/2.3.0/gems/jasmine-2.3.0/lib/jasmine/tasks/jasmine.rake:47:in `block (2 levels) in <top (required)>'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/opt/circleci/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `load'
/opt/circleci/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `<main>'
Tasks: TOP => jasmine:ci
(See full trace by running task with --trace)

bundle exec rake jasmine:ci returned exit code 1
1 Like

I’m also running into this and can’t figure out why. Does anyone have a solution?