[英]How can I resolve “Your bundle only supports platforms [”x86-mingw32“] but your local platforms are [”ruby“, ”x86_64-linux“]”
I'm building a rails site on a Windows machine but when I check in my Gemfile.lock I get the following error on my Travis builds: 我正在Windows机器上构建一个rails网站但是当我检查我的Gemfile.lock时,我的Travis版本出现以下错误:
Your bundle only supports platforms ["x86-mingw32"] but your local platforms are ["ruby", "x86_64-linux"], and there's no compatible match between those two
lists 名单
Here is the full log: https://travis-ci.org/bikebike/BikeBike/builds/222395810#L654 这是完整的日志: https : //travis-ci.org/bikebike/BikeBike/builds/222395810#L654
I looked at my Gemfile.lock and it states: 我查看了我的Gemfile.lock并说明:
PLATFORMS
x86-mingw32
Which appears to be part of the issue. 这似乎是问题的一部分。 I've tried putting any windows specific gems in a
platforms
block: 我已经尝试将任何特定于Windows的宝石放在
platforms
块中:
platforms 'mswin', 'mingw', 'mswin64', 'x64_mingw' do
gem 'tzinfo-data'
group :test do
gem 'wdm', '>= 0.1.0'
gem 'win32console', require: false
end
end
But the Gemfile.lock looks the same. 但是Gemfile.lock看起来是一样的。
Here is my full Gemfile and Gemfile.lock . 这是我的完整Gemfile和Gemfile.lock 。
I can temporarily get around the issue by removing the Gemfile.lock file from git but this is not best practice. 我可以通过从git中删除Gemfile.lock文件来暂时解决这个问题,但这不是最佳做法。 Is there anyway that I can commit my Gemfile.lock file and continue to develop on my Windows machine?
无论如何,我可以提交我的Gemfile.lock文件并继续在我的Windows机器上开发?
Run the following two commands on the command line: 在命令行上运行以下两个命令:
bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux
This will add the two platforms in Gemfile.lock 这将在Gemfile.lock中添加两个平台
I had the same error when deploying to google cloud. 部署到谷歌云时我遇到了同样的错误。 But after running these two commands ruby and x86_64-linux were added and the issue was resolved.
但是在运行这两个命令之后,添加了ruby和x86_64-linux并解决了问题。
For Ruby 2.5.1 I solved this on my VPS by adding also the platforms mentioned in the error message to the platform list section of the gemfile.lock
: 对于Ruby 2.5.1,我在我的VPS上解决了这个问题,将错误消息中提到的平台添加到
gemfile.lock
的platform list部分:
PLATFORMS
x86-mingw32
ruby
x86_64-linux
Only then, running following commands from app's directory (as already shown in taz's answer ) 只有这样,从应用程序目录运行以下命令(如taz的答案中所示)
bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux
lead to success. 导致成功。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.