Hello,

I recently inherited a rails application that uses vagrant. When I run the 
command script that executes the "vagrant up" and "vagrant ssh" commands 
I'm getting the following error:

Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0

I'm using Rbenv and if I run ruby -v the version shows up with ruby 2.1.0p0 
(2013-12-25 revision 44422) [x86_64-linux]

This is the output from vagrant as it's starting up:

[2014-01-15T15:28:21+00:00] INFO: Starting Chef Run for precise32
[2014-01-15T15:28:21+00:00] INFO: Running start handlers
[2014-01-15T15:28:21+00:00] INFO: Start handlers complete.
[2014-01-15T15:28:25+00:00] INFO: execute[update apt] ran successfully
[2014-01-15T15:29:16+00:00] INFO: execute[reticulate directory] ran 
successfully
[2014-01-15T15:29:16+00:00] INFO: execute[vagrant psql role] ran 
successfully
[2014-01-15T15:29:16+00:00] INFO: Chef Run complete in 54.708699 seconds
[2014-01-15T15:29:16+00:00] INFO: Running report handlers
[2014-01-15T15:29:16+00:00] INFO: Report handlers complete
Fetching: bundler-1.5.2.gem (100%)
Successfully installed bundler-1.5.2
1 gem installed
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0

Looking through the process it looks like it might be failing when it gets 
to these lines, but I'm not completely sure:

#!/bin/sh
export GEM_HOME=$HOME/.gems
export PATH=$GEM_HOME/bin:$PATH

bundle -v 2>/dev/null || gem install bundler --no-rdoc --no-ri
bundle install

bundle exec rake db:create db:migrate db:seed
bundle exec rails s

I came across a couple of posts in github where people ran into this issue 
running rake commands that were making a call to heroku and fixed it by 
calling Bundler.with_clean_env{sh "cmd" } but this didn't work for me.

The recipe file has the following, in case this helps:

ENV['LANGUAGE'] = ENV['LANG'] = ENV['LC_ALL'] = "en_US.UTF-8"

execute "update apt" do
  command "apt-get update"
end

package 'libxslt1-dev'
package 'libxml2-dev'
package 'build-essential'
package 'g++'
package 'ruby1.9.1-dev'
package 'postgresql'
package 'postgresql-contrib'
package 'libpq-dev'
package 'git'
package 'nodejs'
package 'libqt4-dev'

execute "web directory" do
  command "mkdir /var/web"
  creates "/var/web"
end

execute "vagrant psql role" do
  command %{sudo -u postgres createuser -s vagrant &&
            touch /var/web/psql-vagrant.done}
  creates "/var/web/psql-vagrant.done"
end

cookbook_file "/web/config/database.yml" do
  source "database.yml"
end

Anyone have any ideas of what else I can try? I do see that the package 
ruby1.9.1-dev is being installed but I couldn't find a package for 2.1.0, 
so I'm not sure if that is where my issue lies or not.

Thanks for any ideas.

Ben



-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to