简体   繁体   中英

Installed ruby via RVM doesn't run (says NoMemoryError)

I've tried to implode the rvm and install everything from scratch, strangely it worked until I restarted my shell (I use zsh, but the same happens on bash).

The console output:

➜  ~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>'

(This also happens when I use irb, I have at least 2 GB of RAM available) When I try to 'rvm get', I get this:

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.

But strangely the rvm wasn't installed on sudo user, and .rvm sits on my user's homedir. I'm running on OSX 10.8.3

I figured it out. In $PATH, I had the local ruby take precedent over the ruby installed by rvm, but the rails was the one installed by rvm to match the ruby version. (the incorrect $PATH was due to an unneeded entry in my zshrc)

in short, if you're having a similar problem try to

$ which ruby; which rails

and see if they are the correct versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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