Bundler not working with rbenv, could not find [gem]

前端 未结 10 1982
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 10:46

I\'ve just made the switch from rvm to rbenv and I\'m trying to use bundler for gem management. After running bundle install and trying to run

相关标签:
10条回答
  • 2020-12-04 11:38

    I tried all the stuff here, but what did it for me was discovering that I had a .bundler in my user home directory for some reason. This was causing the weird problem above where the 'which' command correctly listed bundle in the shims path, but checking bundle -v showed the old system version, while /Users/jerimiah/.rbenv/shims/bundle showed the latest versions. I deleted .bundler in my home directory, rehashed, restarted my terminal, and everything started working.

    0 讨论(0)
  • 2020-12-04 11:38

    For anyone coming across this issue. This is the easiest solution to the "Can't find gem bundle situation (>= 0.a)

    Command:

    gem update --system 
    

    Then update bundler command:

    bundle update --bundler
    
    0 讨论(0)
  • 2020-12-04 11:45

    Give this rbenv plugin a try, it will make shims aware of the bundler paths

    https://github.com/carsomyr/rbenv-bundler

    0 讨论(0)
  • 2020-12-04 11:46

    I was having the same issue. One hint was that rbenv exec bundle exec command worked and that rbenv exec bundle install --path vendor/bundle worked, but their prefixed equivalents failed.

    I wiped my ~/.rbenv, ~/.gem Gemfile.lock and vendor/bundle a few times trying to start fresh. Once these were cleaned away I tried the following:

    rbenv install 1.9.3-p194
    rbenv rehash # for paranoia's sake
    rbenv global 1.9.3-p194
    gem env # to check that everything was pointing at 1.9 and not the system
    gem install --no-ri --no-rdoc bundler
    rbenv rehash # necessary to load up the bundle executable
    bundle --path=vendor/bundle
    

    and it worked!

    I think the important thing, since I tried this a few times, is to remove the .gem file from your home directory. It seems to get in the way.

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