1

While running puma-dev I got the following error when trying to visit my Rails app:

unexpected exit:
        from /not/the/correct/ruby/path/ruby_executable_hooks:24:in `<main>'

How do you tell puma-dev to use the correct path for loading gems with RVM?

Tom Rossi
  • 11,604
  • 5
  • 65
  • 96

1 Answers1

1

I figured this out and wanted to share it with others who may be looking. puma-dev uses the .powenv file to load the correct RVM configuation. You'll want to put this file in the root of your Rails app:

# .powenv

# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi

# load environment of current project ruby
if
  [ -n "${rvm_path:-}" ] &&
  [ -x "${rvm_path:-}/bin/rvm" ] &&
  rvm_project_environment=`"${rvm_path:-}/bin/rvm" . do rvm env --path 2>/dev/null` &&
  [ -n "${rvm_project_environment:-}" ] &&
  [ -s "${rvm_project_environment:-}" ]
then
  echo "RVM loading: ${rvm_project_environment:-}"
  \. "${rvm_project_environment:-}"
else
  echo "RVM project not found at: $PWD"
fi
Tom Rossi
  • 11,604
  • 5
  • 65
  • 96
  • `.powenv` didn't work for me with Puma 4.3. Renaming the file to `.pumaenv` fixed the issue. – Alexey Aug 30 '20 at 10:30