简体   繁体   English

Ruby 3.2.3 rake似乎不起作用-或其他原因。 耙子流产了! 无法加载此类文件

[英]Ruby 3.2.3 rake does not seem to work - or something. Rake aborted! cannot load such file

So I'm trying to learn Ruby and rails from Lynda.com When I get to the database sections the teacher has us do this schema dump with rake but it aborts and I cant figure out whats wrong (I'm very new to all this so please forgive me =)) 因此,我试图从Lynda.com学习Ruby和rails。当我进入数据库部分时,老师让我们用rake进行了这种模式转储,但它中止了,我无法弄清楚出了什么问题(我对此非常陌生。所以请原谅我=))

OS: Lion 操作系统:Lion
Ruby: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] Ruby:Ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-darwin11.3.0]
Rails: Rails 3.2.3 Rails:Rails 3.2.3
Rake: rake (0.9.2.2) 耙:耙(0.9.2.2)
$PATH: /usr/local/Cellar:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin $ PATH:/ usr / local /地窖:/ usr / local / bin:/ usr / local / sbin:/ usr / local / mysql / bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin:/ usr / local / bin:/ usr / X11 / bin

All the gems should be up to date ( just reinstalled the other day ). 所有的宝石都应该是最新的(前几天才重新安装)。 If you need to know anything else to help troubleshoot please let me know! 如果您需要其他任何帮助解决问题的信息,请告诉我!

This is the errors I'm getting: 这是我得到的错误:

Alex$ rake db:schema:dump
rake aborted!
cannot load such file -- bundler/setup

(See full trace by running task with --trace)


Alex$ rake --trace
rake aborted!
cannot load such file -- bundler/setup
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Alex/Sites/simple_cms/config/boot.rb:6:in `<top (required)>'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Alex/Sites/simple_cms/config/application.rb:1:in `<top (required)>'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/Alex/Sites/simple_cms/Rakefile:5:in `<top (required)>'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/bin/rake:32:in `<main>'

Got this when I tried to reinstall budel and run this command: 当我尝试重新安装budel并运行以下命令时,遇到了此问题:

Alex$ bundle exec rake db:schema:dump
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]

-- Control frame information -----------------------------------------------
c:0030 p:-17562901266652 s:0090 b:0090 l:000089 d:000089 TOP   
c:0029 p:---- s:0088 b:0088 l:000087 d:000087 CFUNC  :require
c:0028 p:0119 s:0084 b:0084 l:000083 d:000083 TOP    /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb:9
c:0027 p:---- s:0082 b:0082 l:000081 d:000081 FINISH
c:0026 p:---- s:0080 b:0080 l:000079 d:000079 CFUNC  :require
c:0025 p:0026 s:0076 b:0076 l:000056 d:000075 BLOCK  /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68
c:0024 p:---- s:0073 b:0073 l:000072 d:000072 FINISH
c:0023 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC  :each
c:0022 p:0091 s:0068 b:0068 l:000056 d:000067 BLOCK  /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66
c:0021 p:---- s:0062 b:0062 l:000061 d:000061 FINISH
c:0020 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC  :each
c:0019 p:0046 s:0057 b:0057 l:000056 d:000056 METHOD /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55
c:0018 p:0021 s:0053 b:0053 l:000052 d:000052 METHOD /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119
c:0017 p:0089 s:0049 b:0049 l:000048 d:000048 TOP    /Users/Alex/Sites/simple_cms/config/application.rb:7
c:0016 p:---- s:0047 b:0047 l:000046 d:000046 FINISH
c:0015 p:---- s:0045 b:0045 l:000044 d:000044 CFUNC  :require
c:0014 p:0026 s:0041 b:0041 l:000040 d:000040 TOP    /Users/Alex/Sites/simple_cms/Rakefile:5
c:0013 p:---- s:0039 b:0039 l:000038 d:000038 FINISH
c:0012 p:---- s:0037 b:0037 l:000036 d:000036 CFUNC  :load
c:0011 p:0013 s:0033 b:0033 l:000032 d:000032 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25
c:0010 p:0274 s:0029 b:0029 l:000028 d:000028 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501
c:0009 p:0009 s:0024 b:0024 l:000017 d:000023 BLOCK  /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82
c:0008 p:0009 s:0022 b:0022 l:000021 d:000021 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133
c:0007 p:0011 s:0018 b:0018 l:000017 d:000017 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81
c:0006 p:0019 s:0015 b:0015 l:000008 d:000014 BLOCK  /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65
c:0005 p:0009 s:0013 b:0013 l:000012 d:000012 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133
c:0004 p:0011 s:0009 b:0009 l:000008 d:000008 METHOD /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63
c:0003 p:0048 s:0006 b:0006 l:0003a8 d:000a48 EVAL   /usr/local/bin/rake:32
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0003a8 d:0003a8 TOP  

...... ......

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6
Alex$ 

The error is to long to fit into this field. 错误很长,无法适应此领域。

I've resolved this by running: 我已经通过运行解决了这个问题:

gem install bundler

If you try that and it shows you have bundler installed, try typing: 如果尝试这样做,则表明已安装捆绑软件,请尝试键入:

bundle exec rake db:schema:dump

You may be running the command outside the scope of the current bundle. 您可能正在当前捆绑软件范围之外运行该命令。

Here's a bit more background information on why you need to add bundle exec in front of your rake commands: 以下是有关为什么需要在rake命令之前添加bundle exec更多背景信息:

http://gembundler.com/ http://gembundler.com/

Also, note that rake isn't required in your 'Gemfile' as long as you have rails specified. 另外,请注意,只要指定了rails ,在“ Gemfile”中就不需要rake rake installs as a dependency of rails . rake安装为rails的依赖项。 To see the correlation, take a look at your Gemfile.lock . 要查看相关性,请查看您的Gemfile.lock

Once you install rvm, add the following to a file named .rvmrc in the root directory of your project: 安装rvm后,将以下内容添加到项目的根目录中的名为.rvmrc的文件中:

if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
  && -s "${rvm_path:-$HOME/.rvm}/environments/ruby-1.9.3-p125@MYPROJECTNAME" ]] ; then
  \. "${rvm_path:-$HOME/.rvm}/environments/ruby-1.9.3-p125@MYPROJECTNAME"  
else
  rvm --create use  "ruby-1.9.3-p125@MYPROJECTNAME"
fi

Substitute your project name for "MYPROJECTNAME" and the appropriate ruby version where you see ruby-1.9.3-p125 . 将项目名称替换为“ MYPROJECTNAME”,并在其中看到ruby-1.9.3-p125的适当的ruby版本。 Then when you change into that directory, rvm will automatically set the gemset and ruby version for you. 然后,当您切换到该目录时,rvm将自动为您设置gemset和ruby版本。

Install rvm 安装rvm

Create a new gemset for ur project. 为您的项目创建一个新的宝石集。 Im betting youre using aystem ruby that comes with Lion in some regards 我会在某些方面使用Lion随附的aystem红宝石来打赌您

The problem seems to be that I installed bundle after I installed ruby & rails. 问题似乎是我在安装ruby&rails之后安装了bundle。 I uninstalled ruby and all my gems (but left bundle and homebrew) and then used rvm to install the latest ruby and rails. 我卸载了ruby和我所有的宝石(但留有捆绑包和自制软件),然后使用rvm安装了最新的ruby和rails。

Also note I did not use sudo unless it required me to. 还要注意,除非需要,否则我不会使用sudo。 I think this put the files in a different place and that might have also helped. 我认为这会将文件放在其他位置,这可能也有所帮助。

rake commands are now working (with out using the bundle command before it). rake命令现在可以正常工作(之前没有使用bundle命令)。

So basically I had bundle installed and then did everything this guy did at the bottom of his questions ( #5 gave me and error and did not install ). 因此,基本上我已经安装了捆绑软件,然后在这个问题的底部做了这个家伙所做的一切(#5给了我错误,并且没有安装)。

How do you install (build) Ruby 1.9.3 on OSX Lion? 如何在OSX Lion上安装(构建)Ruby 1.9.3?

Hope this helps anyone else running into the same problem I did. 希望这可以帮助其他遇到我遇到的同样问题的人。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM