通过RVM安装的ruby不会运行(NoMemoryError说)

时间:2013-06-23 13:08:51

标签: ruby-on-rails ruby macos shell rvm

我试图破坏rvm并从头开始安装所有内容,奇怪的是它一直有效,直到我重新启动我的shell(我使用zsh,但在bash上也是如此)。

控制台输出:

➜  ~backend_folder git:(master) ✗ which rails

/Users/shaioz/.rvm/gems/ruby-1.9.3-p429/bin/rails

➜  ~backend_folder git:(master) ✗ rails server

ruby(10188,0x7fff7176c180) malloc: *** mmap(size=1125878379425792) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
ruby(10188,0x7fff7176c180) malloc: *** mmap(size=1125878379425792) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
/Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require': failed to allocate memory (NoMemoryError)
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/debugger-1.6.0/lib/ruby-debug-base.rb:1:in `<top (required)>'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/debugger-1.6.0/lib/ruby-debug.rb:5:in `<top (required)>'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/debugger-1.6.0/lib/debugger.rb:4:in `<top (required)>'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/shaioz/projects/flayvr-backend/config/application.rb:7:in `<top (required)>'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.1.1/lib/rails/commands.rb:52:in `require'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.1.1/lib/rails/commands.rb:52:in `block in <top (required)>'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
    from /Users/shaioz/.rvm/gems/ruby-1.9.3-p429/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

(这也发生在我使用irb时,我至少有2 GB的RAM可用) 当我尝试'rvm get'时,我明白了:

cat: /Users/shaioz/.rvm/help/get: No such file or directory
Could not update RVM, get some help at #rvm IRC channel at freenode servers.

但奇怪的是,没有在sudo用户上安装rvm,而.rvm位于我用户的homedir上。 我正在运行OSX 10.8.3

1 个答案:

答案 0 :(得分:0)

我明白了。 在$ PATH中,我将本地ruby先于rvm安装的ruby,但是rails是由rvm安装的以匹配ruby版本的。 (不正确的$ PATH是由于我的zshrc中不需要的条目)

简而言之,如果您遇到类似的问题,请尝试

$ which ruby; which rails

并查看它们是否是正确的版本。