ruby - 没有 rvm 或 rbenv 的 ruby 升级后 Ruby 版本不匹配
问题描述
我正在使用 bluepill 管理独角兽,并且在 ruby 升级后独角兽启动失败并出现以下错误:
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:495:in `validate_ruby!': Your Ruby version is 2.1.4, but your Gemfile specified 2.3.7 (Bundler::RubyVersionMismatch)
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:470:in `validate_runtime!'
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler.rb:101:in `setup'
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.17.3/lib/bundler/setup.rb:20:in `<top (required)>'
from /usr/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
E, [2019-02-20T10:42:13.897013 #10437] ERROR -- : reaped #<Process::Status: pid 12149 exit 1> exec()-ed
奇怪的是它只有在通过 capistrano 部署调用时才会失败。如果我在服务器上手动运行它,它运行良好。我尝试了各种各样的东西,但似乎没有任何效果。
提前致谢。
运行独角兽的 Bluepill 配置:
Bluepill.application(APPLICATION_NAME) do |application|
application.working_dir = "/var/apps/APPLICATION_NAME/current"
process "unicorn" do
start_command "/usr/local/bin/bundle exec unicorn -c config/unicorn.rb -E qa -D"
environment ({
"RAILS_ENV" => "qa",
"RACK_ENV" => "qa"
})
pid_file "/var/apps/APPLICATION/shared/pids/unicorn.pid"
cache_actual_pid false
stop_command "kill -QUIT {{PID}}"
restart_command "kill -USR2 {{PID}}"
start_grace_time 60.seconds
stop_grace_time 20.seconds
restart_grace_time 13.seconds
checks :flapping, :times => 2, :within => 30.seconds, :retry_in => 7.seconds
monitor_children do
stop_command "kill -QUIT {{PID}}"
checks :mem_usage, :every => 10.seconds, :below => 500.megabytes, :times => [3,4], :fires => :stop
checks :cpu_usage, :every => 10.seconds, :below => 20, :times => [3,4], :fires => :stop
end
end
end
解决方案
The error is pretty clear: Your Ruby version is 2.1.4, but your Gemfile specified 2.3.7
Did you check the ruby version in your Gemfile? It should match the ruby version you're using and you'll likely need to run
bundle update
and
bundle install
推荐阅读
- asp.net - 如何在 asp.net 核心中使用 AJAX 从操作方法中获取数据?
- tizen - 如何向自定义主题发送信号?
- c++ - 如何在抽象超类的子类中重载 operator+?
- webpack - 'mode' 选项没有被设置,webpack 将回退到 'production' 这个值。字段 'browser' 不包含有效的别名配置
- rust - NEP-141 实施
- c - 数组分配的 GCC 编译错误
- webhooks - curl: (7) 无法连接到 localhost 端口 443:连接被拒绝
- c# - 如何使用 xamarin 在 iOS 项目中的 stacklayout 上显示背景图像
- java - 耗电的谷歌 foobar 挑战未能通过第 4 个测试用例
- python - 深度优先搜索的 N 拼图