Rails 3.1.2 - Bundler 找不到 gem “railties” 的兼容版本

发布于 2025-01-01 05:44:39 字数 1890 浏览 2 评论 0原文

我正在尝试安装新版本的 twitter-bootstrap-rails gem (v2),但出现上述错误。这是我的 Gemfile 的样子:

source 'http://rubygems.org'

gem 'rails', '3.1.2'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'


gem 'mysql2'
gem 'authlogic'
gem "paperclip", "~> 2.4.5"
gem 'aws-s3'
gem 'actionmailer'
gem "twitter-bootstrap-rails", "~> 2.0"
gem 'sunspot_rails'

#endless page
gem 'will_paginate'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5.rc.2'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

group :production do
  gem 'therubyracer-heroku', '~> 0.8.1.pre3'
  gem 'pg'
  gem 'thin'
end

group :development do
  gem "taps", "~> 0.3.23"
  gem "rvm", "~> 1.9.2"
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

完整的错误:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

    sass-rails (~> 3.1.5.rc.2) ruby depends on
      railties (3.1.0)

出了什么问题?当我删除版本 ~>; 2.0 来自 gem,它可以工作,但我需要新版本的 bootstrap...

编辑: 捆绑安装

Bundler could not find compatible versions for gem "railties":
  In snapshot (Gemfile.lock):
    railties (3.1.2)

  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

I am trying to install the new version of the twitter-bootstrap-rails gem (v2), but getting the error above. This is how my Gemfile looks:

source 'http://rubygems.org'

gem 'rails', '3.1.2'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'


gem 'mysql2'
gem 'authlogic'
gem "paperclip", "~> 2.4.5"
gem 'aws-s3'
gem 'actionmailer'
gem "twitter-bootstrap-rails", "~> 2.0"
gem 'sunspot_rails'

#endless page
gem 'will_paginate'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5.rc.2'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

group :production do
  gem 'therubyracer-heroku', '~> 0.8.1.pre3'
  gem 'pg'
  gem 'thin'
end

group :development do
  gem "taps", "~> 0.3.23"
  gem "rvm", "~> 1.9.2"
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

And complete error:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

    sass-rails (~> 3.1.5.rc.2) ruby depends on
      railties (3.1.0)

What is wrong? When I remove the version ~> 2.0 from the gem, it works, but I need the new version of bootstrap...

EDIT: bundle install

Bundler could not find compatible versions for gem "railties":
  In snapshot (Gemfile.lock):
    railties (3.1.2)

  In Gemfile:
    twitter-bootstrap-rails (~> 2.0) ruby depends on
      railties (>= 3.2.1) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝眼泪 2025-01-08 05:44:39

解决方案:

gem 'rails', '3.2.1'
gem "sass-rails", "~> 3.2.4"
gem "coffee-rails", "~> 3.2.2"

然后

bundle update

Solution:

gem 'rails', '3.2.1'
gem "sass-rails", "~> 3.2.4"
gem "coffee-rails", "~> 3.2.2"

And then

bundle update
眼眸 2025-01-08 05:44:39

答案就在 Bundler 的输出中。您的项目正在使用 Rails 3.1.2,这需要 Railties 3.1.2。您尝试安装的 twitter-bootstrap-rails 版本显然取决于railties >= 3.2.1,而您没有。

从外观上看,您有三个选择:

  1. 看看 twitter-bootstrap -rails repo 并注意这样一个事实:看起来他们正在尝试将依赖关系降低回 >= 3.1。等待新版本发布或使用他们的主分支。
  2. 升级您的项目以使用 Rails 3.2
  3. 使用仍可与 Rails 3.1 配合使用的旧版本 twitter-bootstrap-rails。

The answer is in Bundler's output. Your project is using Rails 3.1.2, which requires railties 3.1.2. The version of twitter-bootstrap-rails you are trying to install apparently depends on railties >= 3.2.1, which you don't have.

You have three options, from the looks of it:

  1. Take a look at the twitter-bootstrap-rails repo and take note of the fact that it looks like they are trying to lower the dependencies back to >= 3.1. Wait for a new version to be released or use their master branch.
  2. Upgrade your project to use Rails 3.2
  3. Use an older version of twitter-bootstrap-rails that still works with Rails 3.1.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文