使用fastlane+shorebird_release插件构建iOS应用时遇找不到action错误
执行fastlane lane时找不到shorebird_release action的问题
问题描述
我尝试用fastlane结合shorebird_release插件构建应用,执行bundle exec fastlane [lane名称]命令时出错,提示无法加载插件,找不到shorebird_release这个action、lane或变量。
错误日志
[12:57:37]: It seems like you wanted to load some plugins, however they couldn't be loaded [12:57:37]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/ [12:57:37]: ------------------------------ [12:57:37]: --- Step: default_platform --- [12:57:37]: ------------------------------ [12:57:37]: Driving the lane 'ios local' 🚀 +------------------------------+ | Lane Context | +------------------+-----------+ | DEFAULT_PLATFORM | ios | | PLATFORM_NAME | ios | | LANE_NAME | ios local | +------------------+-----------+ [12:57:37]: Called from Fastfile at line 68 [12:57:37]: ``` [12:57:37]: 66: formattedTimestamp = "%d%02d%02d%02d%02d%02d" % [timestamp.year, timestamp.month, timestamp.day, timestamp.hour, timestamp.min, timestamp.sec] [12:57:37]: 67: [12:57:37]: => 68: shorebird_release(platform: "ios") [12:57:37]: 69: [12:57:37]: ``` [12:57:37]: Could not find action, lane or variable 'shorebird_release'. Check out the documentation for more details: https://docs.fastlane.tools/actions +---------------------------------------+ | fastlane summary | +------+------------------+-------------+ | Step | Action | Time (in s) | +------+------------------+-------------+ | 1 | default_platform | 0 | +------+------------------+-------------+ [12:57:37]: fastlane finished with errors [!] Could not find action, lane or variable 'shorebird_release'. Check out the documentation for more details: https://docs.fastlane.tools/actions
Pluginfile内容
# Autogenerated by fastlane # # Ensure this file is checked in to source control! gem 'fastlane-plugin-shorebird'
复现步骤
- 添加fastlane-plugin-shorebird插件
- 在Fastfile的lane中写入
shorebird_release(platform: "ios")调用代码 - 执行命令
bundle exec fastlane (lane name)
涉及的Lane代码
lane :local do require 'yaml' pubspec = YAML.load_file("../../pubspec.yaml") version_string = pubspec["version"] version_number, build_number = version_string.split("+") formattedTimestamp = "%d%02d%02d%02d%02d%02d" % [timestamp.year, timestamp.month, timestamp.day, timestamp.hour, timestamp.min, timestamp.sec] shorebird_release(platform: "ios") end
解决方法
- 确保插件已安装
执行bundle install,让bundler安装Pluginfile中声明的fastlane-plugin-shorebird插件,这是插件被fastlane加载的前提。 - 检查工作目录
执行bundle exec fastlane命令时,必须在包含Pluginfile和Fastfile的目录下,否则fastlane无法读取插件配置。 - 验证版本兼容性
查看fastlane和shorebird插件的版本是否兼容:- 执行
fastlane --version查看fastlane版本 - 执行
gem list fastlane-plugin-shorebird查看插件版本
若不兼容,在Pluginfile中指定兼容的插件版本,例如gem 'fastlane-plugin-shorebird', '~> 0.1.0'(替换为实际兼容版本)。
- 执行
- 手动加载插件
如果自动加载失败,在Fastfile开头添加以下代码强制加载:gem 'fastlane-plugin-shorebird' require 'fastlane/plugin/shorebird' - 确认shorebird CLI已安装
该插件依赖shorebird官方CLI工具,确保已全局安装,在终端执行shorebird命令验证是否可用。
内容的提问来源于stack exchange,提问作者Nicola Rigoni
相关产品推荐
相关产品推荐

