RVM installed by Ruby not working?

前端 未结 10 1253
不知归路
不知归路 2020-12-04 23:36

I installed RVM using the single instruction mentioned at the RVM website (using git).

Then I installed Ruby version 1.9.2 and 1.8.7 using:

rvm insta         


        
相关标签:
10条回答
  • 2020-12-05 00:31

    I set my shell as a login shell (open terminal > Edit > Profile Preferences > Command tab > "Run command as a login shell") though I'm not 100% sure it's needed.

    Once you're done installing RVM + Ruby though, you must specify which ruby you will be using. I like to use

    rvm use --latest --default

    0 讨论(0)
  • 2020-12-05 00:39

    Here is how to fix undetected Rubies inside RVM.

    First, I did a sanity check to make sure that very thing looks great, then ran

    rvm use ruby --default
    

    which did the job. It comes down to this command:

    -SVE1411EGXB:~/code$ cd app1/
      -SVE1411EGXB:~/code/app1$ rails s
    The program 'rails' can be found in the following packages:
     * ruby-railties-3.2
     * ruby-railties-4.0
    Try: sudo apt-get install <selected package>
      -SVE1411EGXB:~/code/app1$ rails s
    The program 'rails' can be found in the following packages:
     * ruby-railties-3.2
     * ruby-railties-4.0
    Try: sudo apt-get install <selected package>
      -SVE1411EGXB:~/code/app1$ which ruby
      -SVE1411EGXB:~/code/app1$ which gem
      -SVE1411EGXB:~/code/app1$ rvm list
    
    rvm rubies
    
    =* ruby-2.1.2 [ x86_64 ]
    
    # => - current
    # =* - current && default
    #  * - default
    
      -SVE1411EGXB:~/code/app1$ \curl -sSL https://get.rvm.io | bash -s stable
    Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
    
    Upgrading the RVM installation in /home  /.rvm/
        RVM PATH line found in /home  /.profile /home  /.bashrc /home  /.zshrc.
        RVM sourcing line found in /home  /.bashrc /home  /.bash_profile /home  /.zlogin.
    Upgrade of RVM in /home  /.rvm/ is complete.
    
    # nullsoulexception,
    #
    #   Thank you for using RVM!
    #   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
    #
    # ~Wayne, Michal & team.
    
    In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
    
    Upgrade Notes:
    
      * No new notes to display.
    
      -SVE1411EGXB:~/code/app1$ rails s
    The program 'rails' can be found in the following packages:
     * ruby-railties-3.2
     * ruby-railties-4.0
    Try: sudo apt-get install <selected package>
      -SVE1411EGXB:~/code/app1$ source ~/.rvm/scripts/rvm
      -SVE1411EGXB:~/code/app1$ rvm requirements
    Checking requirements for ubuntu.
    Requirements installation successful.
      -SVE1411EGXB:~/code/app1$ rvm get stable
    Downloading https://get.rvm.io
    Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
    
    Upgrading the RVM installation in /home  /.rvm/
        RVM PATH line found in /home  /.profile /home  /.bashrc /home  /.zshrc.
        RVM sourcing line found in /home  /.bashrc /home  /.bash_profile /home  /.zlogin.
    Upgrade of RVM in /home  /.rvm/ is complete.
    
    # nullsoulexception,
    #
    #   Thank you for using RVM!
    #   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
    #
    # ~Wayne, Michal & team.
    
    In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
    
    Upgrade Notes:
    
      * No new notes to display.
    
    RVM reloaded!
      -SVE1411EGXB:~/code/app1$ rvm reload
    RVM reloaded!
      -SVE1411EGXB:~/code/app1$ rvm list known
    # MRI Rubies
    [ruby-]1.8.6[-p420]
    [ruby-]1.8.7[-head] # security released on head
    [ruby-]1.9.1[-p431]
    [ruby-]1.9.2[-head] # security released on head
    [ruby-]1.9.3[-p547]
    [ruby-]2.0.0-p451
    [ruby-]2.0.0[-p481]
    [ruby-]2.1.1
    [ruby-]2.1[.2]
    [ruby-]2.1-head
    ruby-head
    
    # GoRuby
    goruby
    
    # Topaz
    topaz
    
    # TheCodeShop - MRI experimental patches
    tcs
    
    # jamesgolick - All around gangster
    jamesgolick
    
    # Minimalistic ruby implementation - ISO 30170:2012
    mruby[-head]
    
    # JRuby
    jruby-1.6.8
    jruby[-1.7.12]
    jruby-head
    
    # Rubinius
    rbx-2.0.0
    rbx-2.1.1
    rbx[-2.2.7]
    rbx-head
    
    # Ruby Enterprise Edition
    ree-1.8.6
    ree[-1.8.7][-2012.02]
    
    # Kiji
    kiji
    
    # MagLev
    maglev[-head]
    maglev-1.0.0
    
    # Mac OS X Snow Leopard Or Newer
    macruby-0.10
    macruby-0.11
    macruby[-0.12]
    macruby-nightly
    macruby-head
    
    # Opal
    opal
    
    # IronRuby
    ironruby[-1.1.3]
    ironruby-head
    
      -SVE1411EGXB:~/code/app1$ ruby -v
    The program 'ruby' can be found in the following packages:
     * ruby
     * ruby1.8
    Try: sudo apt-get install <selected package>
      -SVE1411EGXB:~/code/app1$ rvm use ruby --default
    Using /home  /.rvm/gems/ruby-2.1.2
      -SVE1411EGXB:~/code/app1$ ruby -v
    ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
      -SVE1411EGXB:~/code/app1$ rails s
    => Booting WEBrick
    => Rails 4.1.1 application starting in development on http://0.0.0.0:3000
    => Run `rails server -h` for more startup options
    => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
    
    0 讨论(0)
  • 2020-12-05 00:41

    I had similar problem (using Ubuntu 13.10) to solve it

    $ source .rvm/scripts/rvm 
    

    and for long term

    $ echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
    
    $ ruby -v
    
    
    The program 'ruby' can be found in the following packages:
     * ruby1.8
     * ruby1.9.1
    Try: sudo apt-get install <selected package>
    
    $ source .rvm/scripts/rvm
    
    $ ruby -v
    
    ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
    
    0 讨论(0)
  • 2020-12-05 00:42

    RVM requires a minor addition to your ~/.bashrc or ~/.bash_profile to initialize it when you log-in. It is specified in the installation docs in the Post Install section. Did you do that?


    Per your rvm info output, it looks like you haven't completed your installation. All the entries in the output should have corresponding values. So, I suspect you haven't added:

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.
    

    to your ~/.bashrc or ~/.bash_profile and then started a new session.

    If you are doing a "Multi-User" installation then you'll need to do a lot more. Have you modified /etc/profile, or, if you are using Bash as your shell, have you modified /etc/bash.bashrc to include:

    # Load RVM if it is installed,
    #  first try to load  user install
    #  then try to load root install, if user install is not there.
    if [ -s "$HOME/.rvm/scripts/rvm" ] ; then
      . "$HOME/.rvm/scripts/rvm"
    elif [ -s "/usr/local/rvm/scripts/rvm" ] ; then
      . "/usr/local/rvm/scripts/rvm"
    fi
    

    and started a new shell?

    Personally I don't like the multi-user install as much as the single-user install, and don't recommend it but your mileage might vary.


    As a FYI: In a discussion with the RVM maintainers on IRC last year, they told me they do not recommend the system-wide installation, and instead recommend the local "single-user" installation, even for servers.

    0 讨论(0)
提交回复
热议问题