How to reinstall a gem using bundler

前端 未结 8 1704

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:21

    If using RVM with gems in ~/.rvm/, this works if bundle is not re-installing a gem.

    First, delete the gem source:

    bundle show $GEM
    rm -rf $PATH_TO_GEM
    

    Clear out the compiled gem cache:

    rm -rf ~/.rvm/gems/ruby-$RUBYVERSION[@$GEMSET]/cache/$GEM.gem
    

    Also clear out bundler's spec cache:

    rm -rf ~/.rvm/gems/ruby-$RUBYVERSION[@$GEMSET]/specifications/$GEM*gemspec
    

    Then you can re-install:

    bundle install
    

提交回复
热议问题