How to reinstall a gem using bundler

前端 未结 8 1692

I did a bundle show and get the complete path to a gem directory.

Unfortunately, I removed the directory using rm -r gem_path. Then my rails ap

相关标签:
8条回答
  • 2021-01-30 20:34

    From project directory in terminal

    gem uninstall gem_name 
    
    0 讨论(0)
  • 2021-01-30 20:41

    If using rbenv, this will let you completely uninstall and re-install a gem such as rmagick:

    First: Try a simple uninstall/reinstall

    gem uninstall rmagick
    bundle install
    

    If that doesn't work, you can remove all trace of the installed gem. Find your gem installation location:

    bundle show rmagick
    BUNDLE_DIR=$(dirname $(dirname $(bundle show rmagick)))
    echo $BUNDLE_DIR
    

    Your gem installation prefix will either be the default e.g. ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0 or something you set e.g. .vendor

    Clear out the gem directory:

    rm -rf $BUNDLE_DIR/gems/rmagick-*
    

    Clear out the compiled gem cache:

    rm $BUNDLE_DIR/cache/rmagick*.gem
    

    Also clear out bundler's spec cache:

    rm $BUNDLE_DIR/specifications/rmagick*gemspec
    

    Then you can re-install:

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