1

Hello I'm using Phusion Passenger and NGINX to run a RoR app. but got this error The Phusion Passenger application server tried to start the web application. But the application itself (and not Passenger) encountered an internal error.

Error details:

Your Ruby version is 2.3.1, but your Gemfile specified 2.5.1 (Bundler::RubyVersionMismatch)
  /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:491:in `validate_ruby!'
  /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:466:in `validate_runtime!'
  /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler.rb:101:in `setup'
  /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/setup.rb:20:in `<top (required)>'
  /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:363:in `activate_gem'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:527:in `running_bundler'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
The stdout/stderr output of the subprocess so far is:

Error: The application encountered the following error: Your Ruby version is 2.3.1, but your Gemfile specified 2.5.1 (Bundler::RubyVersionMismatch)
    /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:491:in `validate_ruby!'
    /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:466:in `validate_runtime!'
    /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler.rb:101:in `setup'
    /var/lib/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/setup.rb:20:in `<top (required)>'
    /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:363:in `activate_gem'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:527:in `running_bundler'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `run_block_and_record_step_progress'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Then I check my installed ruby version. ruby -v

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
rbenv 1.1.1-30-gc8ba27f
Rails 5.2.0

But there is not any gem folder 2.5.1 inside /var/lib/gems directory. only 2.3.0 folder exists.

and even ruby version 2.5.1 not present in /usr/lib/ruby/ directory. only 2.3.0 present.

EDIT: I also tried to change the ruby version inside my Gemfile but got an error.

Your Ruby version is 2.5.1, but your Gemfile specified 2.3.1

But when I start my app with rails s the app bootups.

Jasjeet Singh
  • 332
  • 1
  • 6
  • 18

2 Answers2

1

try use RVM (https://rvm.io/) and install proper version of ruby and set the default.

Yijia Su
  • 314
  • 1
  • 5
0

Change the version in your Gemfile back to 2.5.1, and run bundle install. This should update your Gemfile.lock, and will re-install or update dependencies if needed.

After that, try starting with passenger

The folder named 2.3.0 is a red herring, I believe. I've noticed the folder name doesn't seem to sync with the ruby version so I would ignore that.

Jay Dorsey
  • 3,563
  • 2
  • 18
  • 24