Ubuntu RVM Rails bash command not found

后端 未结 2 875
挽巷
挽巷 2021-02-06 11:01

I just installed ubuntu, and after that I wanted to install RVM with ruby and rails 3.1.

Installations went fine but when I want to create a rails app it can\'t find the

相关标签:
2条回答
  • 2021-02-06 11:45

    You need to

    Add rvm to your .bashrc by adding a line like

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
    

    This will allow you to load rvm when you start a new bash session

    create a new Gemset when you want a new rails.

    The work flow should work like this

    $ mkdir new_rails_app
    $ cd new_rails_app
    $ vim .rvmrc
    
    # edit the .rvmrc to use the correct Gemset Something like 
    rvm use ruby-1.9.2-p180@new_rails_app --create
    
    #save and exit vim
    
    $ rvm rvmrc load
    # you should see a prompt that your Gemset was loaded
    
    $ gem install rails
    $ rails new .
    

    You now have a working rails directory for a new app using rvm. There are other little tricks like auto loading your rvmrc's but I left that out just for the sake of the "easiest" route.

    0 讨论(0)
  • 2021-02-06 11:58

    I meet the issue "command not found: rails" too, but I'm using oh-my-zsh for the shell prompt, and I fix the issue by copy the line

    PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
    

    from file ~/.bashrc to ~/.zshrc, and it works well. Hope it can give you some help.

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