まじめなことを書くつもりでやっています。 適当なことは 「一角獣は夜に啼く」 に書いています。
この広告は、90日以上更新していないブログに表示しています。
CircleCI のmacOS ビルドコンテナで fastlane を使ってiOS プロジェクトのビルドをしているのだが、以下のようなエラーが出るようになってしまった。 根本的な原因はわかってないけど、とりあえずメモとして残しておく。
bundle exec fastlane tests[⠦] 🚀 bundler: failed to load command: fastlane (/Users/distiller/project/vendor/bundle/ruby/2.3.0/bin/fastlane)LoadError: cannot load such file -- bundler /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugin_manager.rb:5:in `require' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugin_manager.rb:5:in `<class:PluginManager>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugin_manager.rb:4:in `<module:Fastlane>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugin_manager.rb:3:in `<top (required)>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugins.rb:9:in `require' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/plugins/plugins.rb:9:in `<top (required)>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane.rb:27:in `require' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane.rb:27:in `<top (required)>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/cli_tools_distributor.rb:41:in `require' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/fastlane/lib/fastlane/cli_tools_distributor.rb:41:in `take_off' /Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/fastlane-2.128.1/bin/fastlane:23:in `<top (required)>' /Users/distiller/project/vendor/bundle/ruby/2.3.0/bin/fastlane:22:in `load' /Users/distiller/project/vendor/bundle/ruby/2.3.0/bin/fastlane:22:in `<top (required)>'
fastlane の中のrequire 'bundler'
している箇所で 「LoadError: cannot load such file -- bundler」 というエラーが発生している。
このエラーが発生したのは Bundler のバージョン 2.1.1 を使用している時で、Bundler 2.0.2 を使用している時には問題は起こらなかった。Ruby やRubyGems のバージョンは次の通り。
$ ruby --versionruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]$ gem --version2.5.2.3
とりあえず Bundler のバージョンによって挙動が違うっぽいので Bundler のバージョンを変えながら挙動を確認してみた。
# 両方の Bundler をインストール$ sudo gem install bundler -v 2.1.1Fetching: bundler-2.1.1.gem (100%)Successfully installed bundler-2.1.11 gem installed$ sudo gem install bundler -v 2.0.2Successfully installed bundler-2.0.21 gem installed# Bundler 2.1.1 で require 'bundler' した場合はエラー$ bundle _2.1.1_ exec irbirb(main):001:0> require 'bundler'LoadError: cannot load such file -- bundlerfrom (irb):1:in `require'from (irb):1from /usr/bin/irb:11:in `<top (required)>'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli/exec.rb:63:in `load'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli/exec.rb:63:in `kernel_load'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli/exec.rb:28:in `run'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli.rb:476:in `exec'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli.rb:30:in `dispatch'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/cli.rb:24:in `start'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/exe/bundle:46:in `block in <top (required)>'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'from /Library/Ruby/Gems/2.3.0/gems/bundler-2.1.1/exe/bundle:34:in `<top (required)>'from /usr/local/bin/bundle:22:in `load'from /usr/local/bin/bundle:22:in `<main>'irb(main):002:0> exit# Bundler 2.0.2 だと問題なし$ bundle _2.0.2_ exec irbirb(main):001:0> require 'bundler'=> falseirb(main):002:0> exit
ちなみにRuby とRubyGems のバージョンを上げると、Bundler 2.1.1 を使ってもこの問題は起こらなかった。
$ ruby --versionruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin17]$ gem --version3.1.1$ bundle exec irb irb(main):001:0> require 'bundler'=> false
CircleCI のmacOS ビルドコンテナだとchruby
コマンドを使ってRuby の新しいバージョンを使えるっぽいので (Xcode 10.1 のコンテナで確認)、対応策としては新しいバージョンのRuby を使うようにするのが良さそう。
引用をストックしました
引用するにはまずログインしてください
引用をストックできませんでした。再度お試しください
限定公開記事のため引用できません。