On my ubuntu server, I switched the ruby versioning strategy from using rvm
to rbenv
. When I restart the nginx server, I get this error:
Bundler was unable to find one of the gems defined in the Gemfile
However, this exception is a bit misleading because another message says that a possible issue is:
The application may be run under the wrong Ruby interpreter. It is currently being run under /usr/bin/ruby2.7.
So I'm sure the issue is that the incorrect ruby interpreter is being referenced by passenger because I am actually running ruby version 3.2.4
with rbenv. How do I fix this?
First you have to find where your desired ruby interpreter is. In linux: the easiest way to find that out is to run which ruby
.
> which ruby
> /home/<SomeUserOnYourServer>/.rbenv/shims/ruby
Then go to the server block of your nginx configuration and specify that path above (the path to your desired ruby interpreter) for the passenger_ruby
directive:
passenger_ruby /home/<SomeUserOnYourServer>/.rbenv/shims/ruby;
Restart your nginx server and see if it worked.