首页 > 解决方案 > Ruby:安装了 bundler-2.2.7 导致安装旧的 gem。如何强制它使用 bundler-2.2.5 或其他解决方案?

问题描述

我这样安装了 Fastlane gem:

gem cleanup
gem list bundler
bundle install --no-document bundler -v 2.2.5
gem install fastlane

但是我收到了这个错误:正如你所见,它下载了 fastlane-2.54.1,我需要一个更新的版本,即 fastlane-2.171.0

Cleaning up installed gems...
 Clean up complete
 bundler (default: 2.2.3)
 Unknown switches "--no-document", "-v"
 Did you mean?  "--no-prune"
 Successfully installed rouge-2.0.7
 Successfully installed xcpretty-0.3.0
 Successfully installed xcpretty-travis-formatter-1.0.1
 Successfully installed nanaimo-0.3.0
 Successfully installed colored2-3.1.2
 Successfully installed claide-1.0.3
 Successfully installed CFPropertyList-2.3.6
 Successfully installed atomos-0.1.3
 Successfully installed xcodeproj-1.19.0
 Successfully installed word_wrap-1.0.0
 Successfully installed tty-screen-0.5.1
 Successfully installed unicode-display_width-1.7.0
 Successfully installed terminal-table-1.8.0
 Successfully installed terminal-notifier-1.8.0
 Successfully installed slack-notifier-1.5.1
 Successfully installed security-0.1.3
 Successfully installed rubyzip-1.3.0
 Successfully installed plist-3.6.0
 Successfully installed multi_xml-0.6.0
 Successfully installed multipart-post-2.0.0
 Successfully installed multi_json-1.15.0
 Successfully installed mini_magick-4.5.1
 Successfully installed highline-1.7.10
 Successfully installed thor-1.1.0
 Successfully installed webrick-1.7.0
 Successfully installed jwt-2.2.2
 Successfully installed faraday-0.17.3
 Successfully installed public_suffix-4.0.6
 Successfully installed addressable-2.7.0
 Successfully installed signet-0.14.1
 Successfully installed retriable-3.1.2
 Successfully installed uber-0.1.0
 Successfully installed declarative-option-0.1.0
 Successfully installed declarative-0.0.20
 Successfully installed representable-3.0.4
 Successfully installed mini_mime-1.0.2
 Successfully installed httpclient-2.8.3
 Successfully installed os-1.1.1
 Successfully installed memoist-0.16.2
 Successfully installed googleauth-0.15.0
 Successfully installed google-apis-core-0.2.1
 Successfully installed google-apis-discovery_v1-0.1.0
 Successfully installed gems-1.2.0
 Successfully installed zeitwerk-2.4.2
 Successfully installed concurrent-ruby-1.1.8
 Successfully installed tzinfo-2.0.4
 
 HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
 But that may break your application.
 
 If you are upgrading your Rails application from an older version of Rails:
 
 Please check your Rails app for 'config.i18n.fallbacks = true'.
 If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
 'config.i18n.fallbacks = [I18n.default_locale]'.
 If not, fallbacks will be broken in your app by I18n 1.1.x.
 
 If you are starting a NEW Rails application, you can ignore this notice.
 
 For more info see:
 https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
 
 Successfully installed i18n-1.8.7
 Successfully installed activesupport-6.1.1
 Successfully installed google-apis-generator-0.1.2
 *******************************************************************************
 The google-api-client gem is deprecated and will likely not be updated further.
 
 Instead, please install the gem corresponding to the specific service to use.
 For example, to use the Google Drive V3 client, install google-apis-drive_v3.
 For more information, see the FAQ in the OVERVIEW.md file or the YARD docs.
 *******************************************************************************
 Successfully installed google-api-client-0.53.0
 Successfully installed gh_inspector-1.1.3
 Successfully installed fastimage-2.2.1
 Successfully installed faraday_middleware-0.14.0
 Building native extensions. This could take a while...
 invalid options: -SHN
 (invalid options are ignored)
 Successfully installed unf_ext-0.0.7.7
 Successfully installed unf-0.1.4
 Successfully installed domain_name-0.5.20190701
 Successfully installed http-cookie-1.0.3
 Successfully installed faraday-cookie_jar-0.0.7
 Successfully installed excon-0.78.1
 Successfully installed dotenv-2.7.6
 Successfully installed commander-fastlane-4.4.6
 Successfully installed colored-1.2
 Successfully installed bundler-1.17.3
 Successfully installed babosa-1.0.4
 Successfully installed fastlane-2.54.1

这是我一周前运行的 gem 命令,它成功地为我下载了正确的 Fastlane gem 版本

gem cleanup
gem list bundler
bundle install bundler 
gem install fastlane
2021-01-18T15:22:52.5729450Z Successfully installed bundler-2.2.5
2021-01-18T15:22:52.5731210Z 1 gem installed
2021-01-18T15:22:53.2670020Z Could not locate Gemfile
2021-01-18T15:22:53.7987180Z Could not locate Gemfile
2021-01-18T15:23:26.8921550Z Successfully installed slack-notifier-2.3.2
2021-01-18T15:23:26.8953050Z Successfully installed atomos-0.1.3
2021-01-18T15:23:26.8962540Z Successfully installed CFPropertyList-3.0.3
2021-01-18T15:23:26.9064490Z Successfully installed claide-1.0.3
2021-01-18T15:23:26.9106410Z Successfully installed colored2-3.1.2
2021-01-18T15:23:26.9107550Z Successfully installed nanaimo-0.3.0
2021-01-18T15:23:26.9108470Z Successfully installed xcodeproj-1.19.0
2021-01-18T15:23:26.9109430Z Successfully installed rouge-2.0.7
2021-01-18T15:23:26.9110370Z Successfully installed xcpretty-0.3.0
2021-01-18T15:23:26.9127830Z Successfully installed terminal-notifier-2.0.0
2021-01-18T15:23:26.9128880Z Successfully installed unicode-display_width-1.7.0
2021-01-18T15:23:26.9129940Z Successfully installed terminal-table-1.8.0
2021-01-18T15:23:26.9130890Z Successfully installed plist-3.6.0
2021-01-18T15:23:26.9132410Z Successfully installed public_suffix-4.0.6
2021-01-18T15:23:26.9133340Z Successfully installed addressable-2.7.0
2021-01-18T15:23:26.9180840Z Successfully installed multipart-post-2.0.0
2021-01-18T15:23:27.8142420Z Successfully installed word_wrap-1.0.0
2021-01-18T15:23:27.8149220Z Successfully installed tty-screen-0.8.1
2021-01-18T15:23:27.8150290Z Successfully installed tty-cursor-0.7.1
2021-01-18T15:23:27.8151220Z Successfully installed tty-spinner-0.9.3
2021-01-18T15:23:27.8152040Z Successfully installed babosa-1.0.4
2021-01-18T15:23:27.8152910Z Successfully installed colored-1.2
2021-01-18T15:23:27.8154190Z Successfully installed highline-1.7.10
2021-01-18T15:23:27.8155390Z Successfully installed commander-fastlane-4.4.6
2021-01-18T15:23:27.8156280Z Successfully installed excon-0.78.1
2021-01-18T15:23:27.8157200Z Successfully installed faraday-net_http-1.0.1
2021-01-18T15:23:27.8158060Z Successfully installed ruby2_keywords-0.0.2
2021-01-18T15:23:27.8158990Z Successfully installed faraday-1.3.0
2021-01-18T15:23:27.8159320Z Building native extensions. This could take a while...
2021-01-18T15:23:38.8884610Z Successfully installed unf_ext-0.0.7.7
2021-01-18T15:23:38.8938770Z Successfully installed unf-0.1.4
2021-01-18T15:23:38.8942020Z Successfully installed domain_name-0.5.20190701
2021-01-18T15:23:38.8945190Z Successfully installed http-cookie-1.0.3
2021-01-18T15:23:38.8946460Z Successfully installed faraday-cookie_jar-0.0.7
2021-01-18T15:23:38.8947890Z Successfully installed faraday_middleware-1.0.0
2021-01-18T15:23:38.8948900Z Successfully installed fastimage-2.2.1
2021-01-18T15:23:38.8978150Z Successfully installed gh_inspector-1.1.3
2021-01-18T15:23:38.8981380Z Successfully installed mini_magick-4.11.0
2021-01-18T15:23:38.8982690Z Successfully installed rubyzip-2.3.0
2021-01-18T15:23:38.8983930Z Successfully installed security-0.1.3
2021-01-18T15:23:38.8985290Z Successfully installed xcpretty-travis-formatter-1.0.1
2021-01-18T15:23:38.8988880Z Successfully installed dotenv-2.7.6
2021-01-18T15:23:38.8990250Z Successfully installed naturally-2.2.1
2021-01-18T15:23:38.8991500Z Successfully installed simctl-1.6.8
2021-01-18T15:23:38.8992750Z Successfully installed jwt-2.2.2
2021-01-18T15:23:38.8994170Z Successfully installed declarative-option-0.1.0
2021-01-18T15:23:38.8997560Z Successfully installed declarative-0.0.20
2021-01-18T15:23:38.9000700Z Successfully installed uber-0.1.0
2021-01-18T15:23:38.9001920Z Successfully installed representable-3.0.4
2021-01-18T15:23:38.9003150Z Successfully installed retriable-3.1.2
2021-01-18T15:23:38.9004340Z Successfully installed mini_mime-1.0.2
2021-01-18T15:23:38.9005600Z Successfully installed multi_json-1.15.0
2021-01-18T15:23:38.9006920Z Successfully installed signet-0.14.0
2021-01-18T15:23:38.9008250Z Successfully installed memoist-0.16.2
2021-01-18T15:23:38.9009400Z Successfully installed os-1.1.1
2021-01-18T15:23:38.9010660Z Successfully installed googleauth-0.14.0
2021-01-18T15:23:38.9012000Z Successfully installed httpclient-2.8.3
2021-01-18T15:23:38.9016350Z Successfully installed google-api-client-0.38.0
2021-01-18T15:23:38.9019500Z Successfully installed google-cloud-env-1.4.0
2021-01-18T15:23:38.9022580Z Successfully installed google-cloud-errors-1.0.1
2021-01-18T15:23:38.9023820Z Successfully installed google-cloud-core-1.5.0
2021-01-18T15:23:38.9040570Z Successfully installed google-apis-core-0.2.0
2021-01-18T15:23:38.9046810Z Successfully installed google-apis-iamcredentials_v1-0.1.0
2021-01-18T15:23:38.9051060Z Successfully installed google-apis-storage_v1-0.1.0
2021-01-18T15:23:38.9054080Z Building native extensions. This could take a while...
2021-01-18T15:24:00.2078850Z Successfully installed digest-crc-0.6.3
2021-01-18T15:24:00.2079760Z Successfully installed google-cloud-storage-1.30.0
2021-01-18T15:24:00.2080490Z Successfully installed emoji_regex-3.2.1
2021-01-18T15:24:00.2081070Z Successfully installed jmespath-1.4.0
2021-01-18T15:24:00.2081750Z Successfully installed aws-partitions-1.416.0
2021-01-18T15:24:00.2082380Z Successfully installed aws-eventstream-1.1.0
2021-01-18T15:24:00.2083440Z Successfully installed aws-sigv4-1.2.2
2021-01-18T15:24:00.2084060Z Successfully installed aws-sdk-core-3.111.1
2021-01-18T15:24:00.2084650Z Successfully installed aws-sdk-kms-1.41.0
2021-01-18T15:24:00.2085300Z Successfully installed aws-sdk-s3-1.87.0
2021-01-18T15:24:00.2085890Z Successfully installed fastlane-2.171.0
2021-01-18T15:24:00.2086180Z 74 gems installed

标签: ruby-on-railsrubyrubygemsfastlane

解决方案


如果您的机器中有多个版本的捆绑程序,如下所示:

 >>gem list bundler

  

      *** LOCAL GEMS ***
    
    bundler (2.1.4, 1.17.1)

要重新捆绑指定要使用的捆绑器,您可以使用此 sintax:

bundler _1.17.1_ install

请注意它是捆绑器而不是捆绑器,您始终可以使用_version_来指定要使用的捆绑包的版本。

>>bundler _1.17.1_ -v 
Bundler version 1.17.1
>> bundler _2.1.4_ -v
Bundler version 2.1.4    

希望使用另一个捆绑器版本可以解决您的问题,干杯。


推荐阅读