【问题标题】:Platforms added to Gemfile.lock添加到 Gemfile.lock 的平台
【发布时间】:2018-02-13 07:26:03
【问题描述】:

我试图在没有明确这样做的情况下追踪几个平台是如何添加到我的Gemfile.lock 中的。在添加新 gem 时,我一定忽略了这些更改,但在添加相同的 Gemfile 更改时,我无法重现相同的 Gemfile.lock 平台添加。

这是添加新平台的提交。

#....
+gem 'sqreen'
+gem 'sanitize'
+

 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
 gem 'jbuilder', '~> 2.5'
@@ -55,6 +57,8 @@ gem 'postmark-rails'
 group :development, :test do
   # Call 'byebug' anywhere in the code to stop execution and get a debugger console
   gem 'byebug', platform: :mri
+  gem 'capybara'
+  gem 'selenium-webdriver'
 end

在同一提交中对Gemfile.lock 的更改:

 PLATFORMS
+  java
   ruby
+  x64-mingw32
+  x86-mingw32
+  x86-mswin32

我尝试在测试应用中重现相同的修改,但这些平台未添加到 Gemfile.lock

我最近在推送 heroku 时注意到了这一点:

Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properly.
remote:        This may result in unexpected gem versions being used in your app.
remote:        In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile

我没有在 Windows 机器上开发,现在正在将特定平台的 gem 添加到 Gemfile.lock,例如:

ffi (1.9.18)
ffi (1.9.18-java)
ffi (1.9.18-x64-mingw32)
ffi (1.9.18-x86-mingw32)

我不完全确定这些平台是如何添加的。不建议直接修改锁定文件,但为了安抚 heroku 警告,我是否应该探索删除所有平台特定引用并删除锁定文件中的非 ruby​​ 平台?欢迎在这里提出任何建议。

rails 5.1.3

【问题讨论】:

    标签: ruby-on-rails ruby rubygems gemfile.lock


    【解决方案1】:

    早上用新鲜的眼光深入研究后,这就是发生的事情。

    我检查了我的 bash 历史记录,发现我在提交问题之前运行了 bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java。这显然会在您的 Gemfile.lock 中添加更多平台,并随后添加特定于平台的依赖项。

    我相信我在终端中运行此程序是为了摆脱我认为是 tzinfo-data 周围的错误。更多关于“错误”的信息在这里https://github.com/tzinfo/tzinfo-data/issues/12

    我没有直接编辑Gemfile.lock,而是运行bundle lock --remove-platform x86-mingw32 x86-mswin32 x64-mingw32 java,这对我的锁定文件进行了适当的编辑。更多信息在这里http://bundler.io/v1.16/bundle_lock.html

    Heroku 在按预期部署时不再抛出错误。希望这对将来的某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2022-06-12
      • 2012-05-08
      • 2021-05-27
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 2013-08-17
      • 2014-12-07
      相关资源
      最近更新 更多