RoR - How to remove Rails 4.1.1 version?

前端 未结 2 465

I am new to RoR and I tried to follow the Ruby on Rails Tutorial from Micheal Hartl. Before starting the tutorial I already set up everything earlier and updated the Rails v

2条回答
  •  情歌与酒
    2021-01-03 07:51

    First find the rails gem directory.

    There are many ways to do it, such as looking in your GEM_HOME and GEM_PATH

    echo $GEM_HOME
    echo $GEM_PATH
    

    Here's a brute-force way:

    find / -type d -name rails-4.1.1 
    

    This may find multiple directories, such as the system's gem directory, cache, docs, bundler directory, ruby versioning directories for RVM or chruby, etc.

    If you're the only user of the system, then remove all of these.

    Immediately verify that 4.1.1 is gone:

    # Show the executable, if any
    which rails  
    
    # Show the version, which should not say 4.1.1
    rails --version
    
    # If you're within a bundle directory
    bundle exec rails --version
    

    Do NOT bundle yet.

    Edit your Gemfile, which may also be asking for Rails 4.1.1, and set the exact Rails version that you want:

    gem 'rails', '= 4.0.5'
    

    Now bundle:

    bundle update
    

    Verify that rails 4.1.1 is not in your Gemfile nor lock:

    grep 4.1.1 Gemfile Gemfile.lock
    

提交回复
热议问题