Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rake aborted! no such file to load --bundler/setup Rails 3.1

I am very new in Rails. after I created a new rails project.

rails new test project

I ran

rake db:create 

In order to create a database. Found the following error message:

rake aborted!
no such file to load -- bundler/setup

I am running

Rails 3.1.0

Ruby 1.9.2p290

rvm 1.8.3

Thank you very much!

my $PATH /Users/Mac/.rvm/scripts/rvm:/Users/Mac/.rvm/bin:/Users/Mac/.local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:{ANT_HOME}/bin

like image 758
Juanito Fatas Avatar asked Sep 20 '11 10:09

Juanito Fatas


4 Answers

Run:

gem install bundler
bundle install
bundle exec rake db:create

You might want to learn about Bundler.

See the link on "Creating new Rails Project".

like image 117
lemoncider Avatar answered Nov 16 '22 06:11

lemoncider


I had the same thing and here's what I found: You probably have more than one version of rake installed (type gem list to see), and your project is specifying you must use the older version of rake.

If you do, then the default rake is the newer one.

If you are in your project directory, and your project's Gemfile specifies the older version of rake, and your type rake db:migrate then the error message is telling you that the 'new' version of rake is not the one you specified in Gemfile, so run bundle exec rake db:migrate so bundler can pick the correct version of rake for you.

like image 45
jpw Avatar answered Nov 16 '22 05:11

jpw


try

gem install bundler

bundle install

to install the gems needed.

rake tasks will fail if you do not have the gems necessary for the rails app.

like image 4
Saifis Avatar answered Nov 16 '22 05:11

Saifis


I just had the same issue. I didn't solve it fully but by running:

bundle exec rake <task> 

I was able to finally run the task I wanted without the error you have.

like image 4
Krystian Avatar answered Nov 16 '22 05:11

Krystian