简体   繁体   English

瑞克中止! 没有这样的文件来加载 --bundler/setup Rails 3.1

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

I am very new in Rails.我是 Rails 的新手。 after I created a new rails project.在我创建了一个新的 rails 项目之后。

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导轨 3.1.0

Ruby 1.9.2p290红宝石 1.9.2p290

rvm 1.8.3房车 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我的 $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 .您可能想了解Bundler

See the link on "Creating new Rails Project" .请参阅“创建新的 Rails 项目”上的链接。

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.我有同样的事情,这是我发现的:您可能安装了多个版本的 rake(键入gem list以查看),并且您的项目指定您必须使用旧版本的 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.如果您在您的项目目录中,并且您的项目的 Gemfile 指定了旧版本的 rake,并且您的类型是 rake db:migrate,那么错误消息会告诉您“新”版本的 rake 不是您在 Gemfile 中指定的版本,所以运行bundle exec rake db:migrate以便 bundler 可以为您选择正确版本的 rake。

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.如果您没有 Rails 应用程序所需的 gem,则 rake 任务将失败。

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.我终于能够运行我想要的任务,而不会出现您遇到的错误。

I got the same error as you while upgrading a non-rails project from Ruby 1.8.x to Ruby 1.9.x.在将非 Rails 项目从 Ruby 1.8.x 升级到 Ruby 1.9.x 时,我遇到了与您相同的错误。 The problem is that the current dir has been removed from LOAD_PATH.问题是当前目录已从 LOAD_PATH 中删除。

Why does Ruby 1.9.2 remove “.” 为什么 Ruby 1.9.2 删除了“.” from LOAD_PATH, and what's the alternative? 来自 LOAD_PATH,还有什么选择?

I had to change a few places from require to require_relative and then it worked.我不得不将几个地方从require更改为require_relative然后它就起作用了。

Have you tried to gem install bundler ?您是否尝试过gem install bundler I'd be surprised it doesn't install when you install the rails gem, but it seems that's your issue...当您安装 rails gem 时它没有安装,我会感到惊讶,但这似乎是您的问题......

在您的 Gemfile 中,在组 :test 下添加 gem 'rack'。

Got the same missing bundler message running rake after upgrading to Ruby 1.9.2.升级到 Ruby 1.9.2 后,运行 rake 时出现相同的丢失捆绑器消息。

Rake needed updating and bundler needed to be reinstalled: Rake 需要更新并且需要重新安装 bundler:

sudo gem update rake须藤宝石更新耙

sudo gem install bundler sudo gem 安装捆绑器

Reinstalling bundler might have fixed the error, but you want to make sure rake is right too.重新安装 bundler 可能已经修复了错误,但您也想确保 rake 是正确的。

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.碰巧,出于某种原因,系统更新在 /usr/bin/rake 创建了一个硬链接,指向 OSX 默认的 1.8 ruby​​ 环境 rake 可执行文件。 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.我的 1.9 ruby​​ 安装在 /usr/local/bin 中,它在我的 PATH 设置中稍后出现,所以当我运行“ruby -v”时,我得到了我所期望的,与“gem environment”相同,但是 rake 任务在你描述的方式。

I just deleted the entry /usr/bin/rake.我刚刚删除了 /usr/bin/rake 条目。 Moving /usr/local/bin up on PATH might've worked too.在 PATH 上移动 /usr/local/bin 可能也有效。 The result of running "which rake" must point to your 1.9 installation.运行“which rake”的结果必须指向您的 1.9 安装。

Hope it helps,希望能帮助到你,

-- José ——何塞

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RVM 设置、rake::doc 和“rake 中止! 没有要加载的文件——初始化程序” - RVM setup, rake::doc, and “rake aborted! no such file to load — initializer” 耙子流产了! 无法加载此类文件Ruby on Rails - rake aborted! cannot load such file Ruby on Rails Rails和捆绑器的Rails 3问题:rake aborted! 找不到RubyGem bundler(&gt; = 0) - Rails 3 problem with rake and bundler: rake aborted! Could not find RubyGem bundler (>= 0) 詹金斯:运行脚本时的行为有所不同-rake命令使rake中止了!\\ n无法加载此类文件-捆绑器错误 - Jenkins: Differing behaviour when running script - rake command gives rake aborted!\ncannot load such file — bundler error “ db:migrate rake”抛出错误“无法加载此类文件-捆绑程序/安装程序” - “db:migrate rake” throwing eror “cannot load such file — bundler/setup” 没有这样的文件加载 - bundler / setup(Ruby on rails) - no such file to load — bundler/setup (Ruby on rails) 耙子流产了! 没有这样的文件加载 - pg(在rails中创建postgre数据库) - rake aborted! no such file to load — pg (Creating postgre database in rails ) 没有要加载的文件 - bundler/setup - no such file to load — bundler/setup 耙子流产了! 没有这样的文件加载 - 赶紧 - rake aborted! no such file to load — rush Ruby on Rails:错误“require”:无法加载此类文件——bundler/setup (LoadError) - Ruby on Rails: Error `require': cannot load such file -- bundler/setup (LoadError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM