[英]How to check the heroku database version from ruby
我想從在本地MacOS開發計算機上運行的Shell方法檢查生產數據庫的版本。 從命令行,我可以成功運行
heroku run rake db:version --remote production
但是如果我打開rails console
會話並輸入
hv = `heroku run rake db:version --remote production`
我看到以下錯誤消息:
/Users/Chris/.rvm/gems/ruby-2.5.1@golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/definition.rb:489:in `validate_ruby!': Your Ruby version is 1.9.3, but your Gemfile specified 2.5.1 (Bundler::RubyVersionMismatch)
from /Users/Chris/.rvm/gems/ruby-2.5.1@golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/definition.rb:464:in `validate_runtime!'
from /Users/Chris/.rvm/gems/ruby-2.5.1@golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler.rb:101:in `setup'
from /Users/Chris/.rvm/gems/ruby-2.5.1@golf_mentor_5.0.7/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/heroku/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require
我正在使用ruby 2.5.1。 heroku --version
命令產生heroku-cli/6.16.13-dbb9c23 (darwin-x64) node-v9.11.1
。 我該如何解決?
事實證明,這與此github https://github.com/bundler/bundler/issues/2489
。 似乎捆包者被heroku cli文件中的shebang弄糊塗了。 解決方案是為打包機使用干凈的環境
Bundler.with_clean_env {`heroku run rake db:version --remote production`}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.