首页 文章

耙子流产!没有这样的文件加载--bundler / setup Rails 3.1

提问于
浏览
50

我是Rails中的新手 . 在我创建了一个新的rails项目之后 .

rails new test project

我跑了

rake db:create

为了创建数据库 . 找到以下错误消息:

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

我在跑步

Rails 3.1.0

Ruby 1.9.2p290

rvm 1.8.3

非常感谢你!

我的$ PATH /Users/Mac/.rvm/scripts/rvm:/Users/Mac/.rvm/bin:/Users/Mac/.local/bin:/opt/local/bin:/opt/local/sbin:/ USR /斌:/ bin中:/ usr / sbin目录:/ sbin目录:在/ usr / local / bin目录:在/ usr /本地/ git的/ bin中:在/ usr / X11 / bin中:{} ANT_HOME / bin中

8 回答

  • 1

    跑:

    gem install bundler
    bundle install
    bundle exec rake db:create
    

    您可能想了解Bundler .

    请参阅"Creating new Rails Project"上的链接 .

  • 1

    我有同样的事情,这就是我发现的:你可能安装了多个rake版本(输入 gem list ),你的项目指定你必须使用旧版本的rake .

    如果这样做,则默认rake是较新的rake .

    如果您在项目目录中,并且您的项目's Gemfile specifies the older version of rake, and your type rake db:migrate then the error message is telling you that the '新版本的rake不是您在Gemfile中指定的版本,那么运行 bundle exec rake db:migrate ,以便bundler可以为您选择正确版本的rake .

  • 0

    尝试

    gem install bundler bundle install

    安装所需的宝石 .

    如果您没有rails应用程序所需的宝石,则rake任务将失败 .

  • 0

    我刚才有同样的问题 . 我没有完全解决它,但通过运行:

    bundle exec rake <task>
    

    我能够在没有你的错误的情况下最终运行我想要的任务 .

  • 4

    你试过 gem install bundler 吗?我在安装rails gem时安装了'd be surprised it doesn',但这似乎是你的问题......

  • 4

    在将非rails项目从Ruby 1.8.x升级到Ruby 1.9.x时,我遇到了同样的错误 . 问题是当前目录已从LOAD_PATH中删除 .

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

    我不得不将 require 的几个地方改为 require_relative 然后才有效 .

  • 12

    在升级到Ruby 1.9.2之后,获得了相同的缺少捆绑器消息运行rake .

    Rake需要更新并且需要重新安装捆绑器:

    sudo gem update rake

    sudo gem install bundler

    重新安装bundler可能已经修复了错误,但你想确保rake也是正确的 .

  • 102

    我正在使用Snow Leopard,最近遇到了类似的问题 . 碰巧,由于某种原因,系统更新在/ usr / bin / rake上创建了一个硬链接,指向OSX默认的1.8 ruby环境rake可执行文件 . 我的1.9 ruby安装位于/ usr / local / bin,后来我的PATH设置,所以当我运行“ruby -v”时,我得到了我所期望的,与“gem environment”相同,但是rake任务失败了你描述的方式 .

    我刚刚删除了条目/ usr / bin / rake . 在PATH上移动/ usr / local / bin可能也有效 . 运行“哪个rake”的结果必须指向1.9安装 .

    希望能帮助到你,

    • 何塞

相关问题