开发者

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 fil开发者_运维问答e 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


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".


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.


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.


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.


Have you tried to gem install bundler? I'd be surprised it doesn't install when you install the rails gem, but it seems that's your issue...


I got the same error as you while upgrading a non-rails project from Ruby 1.8.x to Ruby 1.9.x. The problem is that the current dir has been removed from LOAD_PATH.

Why does Ruby 1.9.2 remove “.” from LOAD_PATH, and what's the alternative?

I had to change a few places from require to require_relative and then it worked.


Got the same missing bundler message running rake after upgrading to Ruby 1.9.2.

Rake needed updating and bundler needed to be reinstalled:

sudo gem update rake

sudo gem install bundler

Reinstalling bundler might have fixed the error, but you want to make sure rake is right too.


I'm using Snow Leopard, had a similar problem recently. It happens that, for some reason, a system update created a hard link at /usr/bin/rake, pointing to OSX default 1.8 ruby environment rake executable. My 1.9 ruby installation is at /usr/local/bin, which comes later on my PATH setting, so when I ran "ruby -v" I got what I expect, same with "gem environment", but rake tasks were failing in the way you describe.

I just deleted the entry /usr/bin/rake. Moving /usr/local/bin up on PATH might've worked too. The result of running "which rake" must point to your 1.9 installation.

Hope it helps,

-- José


In your Gemfile, under group :test do add gem 'rack'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜