快速通道 NoMethodError

Fastlane NoMethodError

我有一台配备 m1 处理器的 macbook(2020),我正在使用 Fastlane 来自动化 AppStore 流程。从今天早上开始我就有问题了。每次我执行 bundle exec fastlane 我都会收到这个错误:

/Library/Ruby/Gems/2.6.0/gems/fastlane-2.206.0/fastlane/lib/fastlane/cli_tools_distributor.rb:145:in `map_aliased_tools': undefined method `to_sym' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.206.0/fastlane/lib/fastlane/cli_tools_distributor.rb:81:in `take_off'
from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.206.0/bin/fastlane:23:in `<top (required)>'
from /usr/local/bin/fastlane:23:in `load'
from /usr/local/bin/fastlane:23:in `<main>'

以下是我使用的工具版本:

  1. ruby 版本:3.0.0p0(2020-12-25 修订版 95aff21468)[x86_64-darwin21]
  2. xcode 版本:13.3 (13E113)
  3. macOS 版本:12.3.1

即使我尝试使用 fastlane init 命令再次设置 fastlane,它仍然给我这个错误。 是什么导致了这个问题?

更新: 我使用 rvm(https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/) 安装了自己的 ruby,然后使用了推荐的安装 fastlane 的方法(使用捆绑器),现在我遇到了类似的错误。

bundler: failed to load command: fastlane (/Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/bin/fastlane)
cli_tools_distributor.rb:145:in `map_aliased_tools': undefined method `to_sym' for nil:NilClass (NoMethodError)
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/fastlane-2.206.0/fastlane/lib/fastlane/cli_tools_distributor.rb:81:in `take_off'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/fastlane-2.206.0/bin/fastlane:23:in `<top (required)>'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/bin/fastlane:23:in `load'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/bin/fastlane:23:in `<top (required)>'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:58:in `load'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli/exec.rb:23:in `run'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli.rb:483:in `exec'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli.rb:31:in `dispatch'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/cli.rb:25:in `start'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/exe/bundle:48:in `block in <top (required)>'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/gems/bundler-2.3.14/exe/bundle:36:in `<top (required)>'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/bin/bundle:23:in `load'
from /Users/mehmetbaykar/.rvm/gems/ruby-3.0.0/bin/bundle:23:in `<main>'

这个错误有一个 open issue。当您 运行 fastlane 没有任何额外的 command-line 参数时会出现此问题。有两个临时解决方法:

  1. 启用详细模式:bundle exec fastlane --verbose
  2. 指定车道名称:bundle exec fastlane my_lane_name

或者,您可以降级到较早版本的 fastlane。