将 Rails 应用程序部署到 render.com 时出错:“您的捆绑包仅支持平台 [“x86_64-darwin-22”],但您的本地平台是 x86_64-linux”

问题描述 投票:0回答:1

当我尝试部署到render.com时,发生错误,我查看了错误,出现了以下消息

==> Running build command 'bundle install; bundle exec rake assets:precompile; bundle exec rake assets:clean;'...
Your bundle only supports platforms ["x86_64-darwin-22"] but your local platform is x86_64-linux.
Add the current platform to the lockfile with `bundle lock --add-platform x86_64-linux` and try again.

调查 首先是 x86_64-darwin-22,它是什么?于是我查了一下,发现: x86_64:PC CPU的位数(信息量) darwin:苹果公司开发的操作系统。发音为 Darwin,似乎是 Mac OS 的基础 22:是版本号吗?

我想尽快用 Apple Silicon 更换我的 Mac...

但是你的本地平台是x86_64-linux。将当前平台添加到lockfile中,因此看来您需要将您的环境的平台添加到Gemfile.lock中。

解决方案 在本地环境使用bundle lock命令更新Gemfile.lock 运行以下命令

$ 捆绑锁 --add-platform x86_64-linux

执行结果 添加了 x86_64-linux!

Gemfile.lock

  • nokogiri(1.13.9-x86_64-linux)
  • racc(〜> 1.4)

平台 x86_64-darwin-22

  • x86_64-linux
ruby-on-rails ruby rubygems render.com
1个回答
0
投票

有类似的问题。这是关于 Heroku,而不是关于 render.com,但也应该可以工作

bundle lock --add-platform x86_64-linux --add-platform ruby
bundle install
git add Gemfile.lock
git commit -m "Bundler fix"

然后重复部署(将新提交推送到您的分支)

© www.soinside.com 2019 - 2024. All rights reserved.