本文介绍了从rbenv切换到rvm,现在不能使用rails。无法激活bundler-1.12.5,已激活bundler-1.13.0.rc.1(Gem::LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
第一个错误:
`check_version_conflict': can't activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError)
变成此错误:
/Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require': dlopen(/Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle, 9): Library not loaded: /Users/phillipjones/.rvm/rubies/ruby-2.3.1/lib/libruby.2.3.0.dylib (LoadError)
Referenced from: /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle
Reason: image not found - /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle
以下是导致此问题的情况和我尝试解决的步骤:
从RVM切换到rbenv后,我在使用使用RVM创建的应用程序时遇到了问题。我无法运行Rails%s。首先我收到以下错误:
Phillip-Joness-MacBook:messengerApp phillipjones$ rails s
/Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError)
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1403:in `activate'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:68:in `block in gem'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in `synchronize'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in `gem'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/postit_trampoline.rb:32:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/setup.rb:2:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/workspace/messengerApp/config/boot.rb:3:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/bin/rails:8:in `require_relative'
from /Users/phillipjones/workspace/messengerApp/bin/rails:8:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/bin/spring:49:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/workspace/messengerApp/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
然后我尝试了包更新。没有变化所以我尝试安装bundler gem:
Phillip-Joness-MacBook:messengerApp phillipjones$ gem install bundler
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
Done installing documentation for bundler after 5 seconds
1 gem installed
不变。
我尝试安装正确的捆绑包版本
Phillip-Joness-MacBook:messengerApp phillipjones$ gem install bundler-1.12.5
ERROR: Could not find a valid gem 'bundler-1.12.5' (>= 0) in any repository
不变。
我自制安装了rbenv-bundler
hillip-Joness-MacBook:rubygems phillipjones$ brew install rbenv-bundler
==> Downloading https://github.com/carsomyr/rbenv-bundler/archive/0.99.tar.gz
==> Downloading from https://codeload.github.com/carsomyr/rbenv-bundler/tar.gz/0.99
######################################################################## 100.0%
🍺 /usr/local/Cellar/rbenv-bundler/0.99: 13 files, 46.6K, built in 10 seconds
再次安装捆绑包,删除gelock.file并运行捆绑包安装
Phillip-Joness-MacBook:rubygems phillipjones$ gem install bundler
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
Done installing documentation for bundler after 5 seconds
1 gem installed
Phillip-Joness-MacBook:rubygems phillipjones$ bundle install
Could not locate Gemfile
Phillip-Joness-MacBook:rubygems phillipjones$ cd ~/workspace/messengerApp/
Phillip-Joness-MacBook:messengerApp phillipjones$ bundle install
Using rake 11.2.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using ansi 1.5.0
Using execjs 2.7.0
Using debug_inspector 0.0.2
Using thor 0.19.1
Using sass 3.4.22
Using byebug 9.0.5
Using coderay 1.1.1
Using coffee-script-source 1.10.0
Using concurrent-ruby 1.0.2
Using ffi 1.9.13
Using bundler 1.12.5
Using formatador 0.2.5
Using rb-fsevent 0.9.7
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using method_source 0.8.2
Using slop 3.6.0
Using guard-compat 1.2.1
Using multi_json 1.12.1
Using turbolinks-source 5.0.0
Using ruby-progressbar 1.8.1
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using mime-types 3.1
Using autoprefixer-rails 6.3.7
Using uglifier 3.0.0
Using binding_of_caller 0.7.2
Using bootstrap-sass 3.2.0.2
Using coffee-script 2.4.1
Using sprockets 3.6.3
Using rb-inotify 0.9.7
Using notiffany 0.1.0
Using pry 0.10.3
Using guard-minitest 2.4.4
Using turbolinks 5.0.0
Using minitest-reporters 1.1.9
Using sdoc 0.4.1
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using listen 3.1.5
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using jbuilder 2.5.0
Using rails-html-sanitizer 1.0.3
Using guard 2.13.0
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.1.1
Using simple_form 3.2.1
Using bootstrap-datepicker-rails 1.6.1.1
Using bootstrap-modal-rails 2.2.5
Using coffee-rails 4.1.1
Using font-awesome-rails 4.6.3.1
Using jquery-rails 4.1.1
Using jquery-turbolinks 2.1.0
Using responders 2.2.0
Using rails 4.2.6
Using sass-rails 5.0.5
Using web-console 2.3.0
Using figaro 0.7.0
Using rails-controller-testing 0.0.3
Bundle complete! 28 Gemfile dependencies, 87 gems now installed.
Gems in the group production were not installed.
Bundled gems are installed into ./vendor/bundle.
然后我检查了rbenv本地。做了一次rbenv重述。我检查了一下扫帚。并再次尝试了rails%s。这一次我收到一个新错误:
Phillip-Joness-MacBook:messengerApp phillipjones$ rbenv local
ruby-2.3.1
Phillip-Joness-MacBook:messengerApp phillipjones$ rbenv rehash
Phillip-Joness-MacBook:messengerApp phillipjones$ rbenv which rake
/Users/phillipjones/.rbenv/versions/2.3.1/bin/rake
Phillip-Joness-MacBook:messengerApp phillipjones$ rails ss
/Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError)
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1403:in `activate'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:68:in `block in gem'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in `synchronize'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in `gem'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/postit_trampoline.rb:32:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/setup.rb:2:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/workspace/messengerApp/config/boot.rb:3:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/bin/rails:8:in `require_relative'
from /Users/phillipjones/workspace/messengerApp/bin/rails:8:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
from /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/phillipjones/workspace/messengerApp/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
推荐答案
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
rbenv rehash
和gem install --no-ri --no-rdoc bundler
的组合应该能够解决这个问题。尝试上面的代码,它应该可以解决您的问题。 这篇关于从rbenv切换到rvm,现在不能使用rails。无法激活bundler-1.12.5,已激活bundler-1.13.0.rc.1(Gem::LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!