Tim Mitchell
Tim Mitchell

Reputation: 663

Gem path error in Ruby on Rails

I'm relatively new to Ruby on Rails.

I have an issue when I try to run the app. I get the following errror:

* ERROR *: Cannot execute /usr/local/rvm/wrappers/ruby-1.8.7-p174@soda/ruby: No such file or directory (2)

This is true; there is no such directory. There is a file called /usr/local/rvm/wrappers/ruby-1.8.7-p174@DACE/ruby - which is exactly the gem file I want to use.

As I understand it, the .rvmrc file specifies the directory for the gem file. In this case, however, the .rvmrc has the following:

rvm --create use  "ruby-1.8.7-p174@DACE"

Furthermore, rvm info statues that /usr/local/rvm/gems/ruby-1.8.7-p174@DACE is in fact the gem path.

So, why does it think it should be looking for this non-existant path?

Thanks in advance, Tim

Upvotes: 4

Views: 1193

Answers (2)

Rahul Roy
Rahul Roy

Reputation: 483

I encountered the same problem while setting up rails production machine with Nginx & Passenger. Here's how I solved the problem.

  1. Make sure passenger gem is installed then cd into project directory and run the following command
passenger-config build-native-support --help

Which will give you output similar to following:

Usage: passenger-config build-native-support [OPTIONS]

Phusion Passenger utilizes a Ruby native extension, called native_support, for improving Ruby performance. The extension depends on the Phusion Passenger version and the Ruby version. Normally, every time you run a Phusion Passenger version with a Ruby version that it hasn't encountered before, it will rebuild the native_support library for that Ruby version. By running this command, you can force the native_support to be built for the current Ruby interpreter.

The current Ruby interpreter is:

Path: /home/deploy/.rvm/gems/ruby-x.x.x@gemset/wrappers/ruby
Version: 2.1.5

Options: -h, --help Show this help

  1. Now copy the Path from output and paste it into nginx configuration file. In my case it was located at /etc/nginx/nginx.conf

    passenger_ruby /home/deploy/.rvm/gems/ruby-x.x.x@gemset/wrappers/ruby

  2. And finally restart the server or run your deployment script.

Upvotes: 0

MurifoX
MurifoX

Reputation: 15109

Run a rvm current to see which version of ruby and which gemset you are using. Then run rvm gemset list to see which gemsets do you have created. If soda is not listed, then do a rvm gemset create soda to create this gemset.
Remove this .rvmrc file and then create another one. (This won't break anything on your project, just the project reference of ruby and gems would be deleted).
You can read this answer to help you understand better how rvm works, there is a link there:

How to make rvmrc file in project root folder?

Upvotes: 1

Related Questions