# Intermittent phantomjs error during build

**URL:** <https://discuss.circleci.com/t/intermittent-phantomjs-error-during-build/6105>\
**Category:** Bug Reports\
**Tags:** rails, phantomjs, javascript\
**Created:** [September 8, 2016, 2:43pm UTC](https://discuss.circleci.com/t/intermittent-phantomjs-error-during-build/6105 "2016-09-08T14:43:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaroalan](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@aaroalan](https://discuss.circleci.com/u/aaroalan)\
**Post date:** [September 8, 2016, 2:43pm UTC](https://discuss.circleci.com/t/intermittent-phantomjs-error-during-build/6105/1 "2016-09-08T14:43:09Z")

</div>

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

```auto
# circle.yml
machine:
  pre:
    - sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1

```

```auto
# 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

```

---

<div class="post-metadata">

**Author:** ![bwest](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@bwest](https://discuss.circleci.com/u/bwest)\
**Post date:** [September 29, 2016, 6:03am UTC](https://discuss.circleci.com/t/intermittent-phantomjs-error-during-build/6105/2 "2016-09-29T06:03:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:34am UTC](https://discuss.circleci.com/t/intermittent-phantomjs-error-during-build/6105/3 "2018-06-18T11:34:21Z")

</div>


