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

前端 未结 9 839
慢半拍i
慢半拍i 2021-02-04 23:41

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

rails new test project

I ran

rake db:create 

In

相关标签:
9条回答
  • 2021-02-05 00:22

    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.

    0 讨论(0)
  • 2021-02-05 00:23

    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é

    0 讨论(0)
  • 2021-02-05 00:30

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

    0 讨论(0)
提交回复
热议问题