Search code examples
ruby-on-railsrakervm

Problems with Rake When Using a Git Clone of a Rails Project with RVM


I have cloned a rails project from Ryan Bates (complex forms samples) and am having a problem with rake. I titled the question generally because I suspect it's an issue with my setup/usage rather than the project itself.

The project I am trying to use is:

I am using RVM on OSX and my default ruby is ruby-1.9.2-p290.

Here are the steps I am doing in a terminal (starting in a new empty directory):

git clone https://github.com/ryanb/complex-form-examples.git

--Created the project without error

The first time I did this, after I changed dir to the "complex-forms-examples", I got an RVM warning which I had not seen before. It was asking for some sort of permission which I granted. It does not do this anymore when I repeat the clone in a new empty directory.

The warning mentioned that there is an .rvmrc file in the directory. The contents are as follows (one line):

rvm 1.9.2@complex-form-examples --create

I then run 'bundle' and have no errors.

Then I try to run "rake db:migrate" and I get the following error:

-bash: /Users/ken/.rvm/gems/ruby-1.9.2-p290@global/bin/rake: /Users/ken/.rvm/rubies/ruby-1.9.2-p136/bin/ruby: bad interpreter: No such file or directory

I get the same error when I run rake by itself or with any other parameter.

I have no ruby 1.9.2-p136 so I don't know why it is trying to use that ruby.

'rails s' is starting the server without error

I am only having problems with this project (i.e. rake is still working fine in my other rails projects).

Can anyone tell me what I'm missing?

Thanks


Solution

  • It could be broken migration/upgrade of ruby, try this:

    rvm 1.9.2@global,1.9.2@complex-form-examples do gem pristine
    rvm 1.9.2@global do gem pristine rake
    

    make sure there is no error reported, in case of errors you need to pristine all gems manually (like in the second line)