我剛剛將這個新 Gem 添加到我的 Gemfile 中:gem 'pg_query'當我在bundle install本地運行時,一切正常。但是,當我嘗試部署到 elasticbean stalk 時,我收到了以前沒有遇到的錯誤:
2021/11/18 00:33:20.171799 [ERROR] An error occurred during execution of command [app-deploy] - [stage ruby application]. Stop running the command. Error: install dependencies in Gemfile failed with error Command /bin/sh -c bundle install failed with error exit status 1. Stderr:Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your lockfile was created by an old Bundler that left some things out.
You can fix this by adding the missing gems to your Gemfile, running bundle install, and then removing the gems from your Gemfile.
The missing gems are:
* google-protobuf depended upon by pg_query
這是我的Gemfile.lock:https : //pastebin.com/X9VqfFkK
這是我的Gemfile:https : //pastebin.com/e9aBu9EQ
任何想法可能會發生什么?我覺得這與彈性豆莖有關,因為我過去在那里安裝 gem 時遇到了麻煩。
uj5u.com熱心網友回復:
看起來請求的 gem google-protobuf 僅包含在 macOS/Darwin 作業系統中。要將其包含在 Linux 系統的 Gemfile.lock 中,您需要在本地運行以下命令:
bundle lock --add-platform x86_64-linux
(我假設 Elastic Beanstalk 使用 Linux - 根據需要調整平臺)
我的理解是這適用于為特定平臺編譯了版本的 gem。默認情況下,Bundler 不包括所有已知平臺 - 因此,如果您的開發和部署環境不同,則添加適當的平臺可確保進一步的捆綁涵蓋所有相關情況。
uj5u.com熱心網友回復:
對于將來可能遇到此問題的任何人,感謝@pat 指出這一點,解決方案似乎是在我的Gemfile.lockfrom 中手動更改此行:
google-protobuf (3.19.1-x86_64-darwin)
到:
google-protobuf (3.19.1)
之后,部署作業并且bundle install在本地作業!我的彈性 beanstalk 上的平臺正在運行 Linux,所以我認為這是初始錯誤的原因之一。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/361361.html
標籤:红宝石轨道 红宝石 亚马逊网络服务 红宝石 亚马逊弹性豆茎
上一篇:如何洗掉rails中的所有錄音?
下一篇:如何訂購開頭包含數字的標題
