Fastlane build error (You require a gem, please call fastlane_require 'rest-client' before to ensure the gem is installed)

I’m trying to build our app, but getting error messages like:

You require a gem, please call fastlane_require 'rest-client' before to ensure the gem is installed

1 Like

Thanks for reporting the issue here!

Relevant part of the log:

+------------------------------------------------------------------------------+
| (4) fastlane@2.2.0                                                           |
+------------------------------------------------------------------------------+
| id: fastlane                                                                 |
| version: 2.2.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2017-01-01T02:35:28-08:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
$ cd .


 (i) Found 'Gemfile' - using it...
$ bundle install
Warning: the running version of Bundler (1.13.1) is older than the version that created the lockfile (1.13.6). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Installing CFPropertyList 2.3.4
Using i18n 0.7.0
Using json 1.8.3
Installing minitest 5.10.1
Using thread_safe 0.3.5
Installing public_suffix 2.0.4
Using babosa 1.0.2
Installing claide 1.0.1
Using colored 1.2
Using highline 1.7.8
Using unf_ext 0.0.7.2
Using dotenv 2.1.1
Installing excon 0.54.0
Using multipart-post 2.0.0
Using bundler 1.13.1
Using gh_inspector 1.0.2
Installing jwt 1.5.6
Using little-plugger 1.1.4
Using multi_json 1.12.1
Using memoist 0.15.0
Using os 0.9.6
Installing httpclient 2.8.3
Using hurley 0.2
Installing mime-types-data 3.2016.0521
Using uber 0.0.15
Using retriable 2.1.0
Using mini_magick 4.5.1
Installing multi_xml 0.6.0
Installing plist 3.2.0
Using rubyzip 1.2.0
Using security 0.1.3
Using slack-notifier 1.5.1
Installing terminal-notifier 1.7.1
Installing unicode-display_width 1.1.2
Using word_wrap 1.0.0
Installing nanaimo 0.2.3
Using rouge 1.11.1
Using tzinfo 1.2.2
Installing addressable 2.5.0
Installing commander 4.4.2
Using unf 0.1.4
Installing faraday 0.10.0
Using logging 2.1.0
Installing mime-types 3.1
Using representable 2.3.0
Installing terminal-table 1.7.3
Installing xcpretty 0.2.4
Using activesupport 4.2.7.1
Installing fastimage 2.0.1
Installing domain_name 0.5.20161129
Installing faraday_middleware 0.10.1
Using signet 0.7.3
Using xcpretty-travis-formatter 0.0.4
Installing xcodeproj 1.4.2
Installing http-cookie 1.0.3
Using googleauth 0.5.1
Installing fastlane-plugin-update_project_codesigning 0.1.7
Using faraday-cookie_jar 0.0.6
Installing google-api-client 0.9.20
Installing fastlane 2.3.0
Bundle complete! 2 Gemfile dependencies, 60 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Fastlane version:
$ bundle exec fastlane --version
fastlane 2.3.0

Run fastlane:
$ bundle exec fastlane store
+--------------------------------------------+---------+----------------------------+
|                                   e[32mUsed pluginse[0m                                    |
+--------------------------------------------+---------+----------------------------+
| Plugin                                     | Version | Action                     |
+--------------------------------------------+---------+----------------------------+
| fastlane-plugin-update_project_codesigning | 0.1.7   | update_project_codesigning |
+--------------------------------------------+---------+----------------------------+

[02:35:42]: e[33mYou require a gem, please call `fastlane_require 'rest-client'` before to ensure the gem is installede[0m
[02:35:42]: e[33mYou require a gem, please call `fastlane_require 'pathname'` before to ensure the gem is installede[0m
[02:35:42]: e[33mYou require a gem, please call `fastlane_require 'xcodeproj'` before to ensure the gem is installede[0m
[02:35:42]: e[33mYou require a gem, please call `fastlane_require 'spaceship'` before to ensure the gem is installede[0m
bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
LoadError: cannot load such file -- rest-client
  Fastfile:21:in `require'
  Fastfile:21:in `parsing_binding'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/fast_file.rb:54:in `eval'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/fast_file.rb:54:in `block in parse'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/fast_file.rb:43:in `chdir'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/fast_file.rb:43:in `parse'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/fast_file.rb:33:in `initialize'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/lane_manager.rb:12:in `new'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/lane_manager.rb:12:in `cruise_lane'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/command_line_handler.rb:30:in `handle'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/commands_generator.rb:96:in `block (2 levels) in run'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.2/lib/commander/command.rb:178:in `call'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.2/lib/commander/command.rb:153:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.2/lib/commander/runner.rb:446:in `run_active_command'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:38:in `run!'
  /usr/local/lib/ruby/gems/2.3.0/gems/commander-4.4.2/lib/commander/delegates.rb:15:in `run!'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/commands_generator.rb:293:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/commands_generator.rb:36:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/fastlane/lib/fastlane/cli_tools_distributor.rb:59:in `take_off'
  /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.3.0/bin/fastlane:5:in `<top (required)>'
  /usr/local/bin/fastlane:23:in `load'
  /usr/local/bin/fastlane:23:in `<top (required)>'
|                                                                              |
+---+---------------------------------------------------------------+----------+
| e[31;1mxe[0m | e[31;1mfastlane@2.2.0 (exit code: 1)e[0m                                 | 16 sec   |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-fastlane/issues           |
| Source: https://github.com/bitrise-io/steps-fastlane                         |
+---+---------------------------------------------------------------+----------+

The most likely cause of this issue is that you did not include some required fastlane gems in your Gemfile / Gemfile.lock.
Fastlane recently restructured how their gem uses / includes other gems, I suspect this issue is caused by that.

There are two possible solutions:

1: switch to using a system installed fastlane: remove the Gemfile and Gemfile.lock, or just fastlane from the Gemfile & Gemfile.lock (don’t forget to run a bundle install after the Gemfile change!)

2: try to solve what else have to be in the Gemfile & Gemfile.lock - based on the log it seems the following gems have to be included: rest-client, pathname, xcodeproj, spaceship

Question: what do you get if you run the same command on your Mac? : bundle install && bundle exec fastlane store (preferably after a clean git clone into /tmp, to make sure you run it on the same state of the code what Bitrise gets when it git clones the repository).

Did you manage to solve the issue @omer?

@omer did you have the time to test the possible solutions I mentioned?