所以背景细节:我在Ubuntu 12.04中运行Ruby 2.2.0和Rails 4.1.0。
当我输入rails -v
时,收到错误消息:
Could not find gem 'sqlite3-ruby (= 1.3.1) ruby' in the gems available on this machine.
Try running `bundle install`.
当我输入bundle install
时:
我明白了:
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.8.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
最糟糕的是,它仍然显示Rails(3.0.1),这不是我计算机上当前版本的rails。
我尝试输入:
来安装sqllite3-rubysudo apt-get install libsqlite3-dev
但我明白了:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsqlite3-dev is already the newest version.
The following packages were automatically installed and are no longer required:
ruby-builder ruby-blankslate ruby-text-format ruby-activesupport-2.3 rubygems ruby-i18n rake libjs-prototype libmemcache-client-ruby1.8
ruby-actionmailer-2.3 libmemcache-client-ruby ruby-activerecord-2.3 ruby-rchardet ruby-rack ruby-tmail libjs-scriptaculous libtzinfo-ruby1.8
ruby-rails-2.3 ruby-activeresource-2.3 libtzinfo-ruby ruby-actionpack-2.3
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 455 not upgraded.
更新
答案 0 :(得分:0)
检查Gemfile中的rails版本。您的应用程序似乎是使用rails 3.0.1构建的。所以bundle install
想要安装Gemfile中请求的所有gem版本。正如您终端中的消息所说,rails 3.0.1依赖于bundler 1.0.0,但您目前已安装了bundler 1.8.4。
哟有两种可能性:将您现有的应用程序升级到您的intsalled rails版本(4.2.0)或将所有已安装的依赖于rails的gem降级为rails 3.0.1。