首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Bundler找不到gem的兼容版本,正在更新Rails应用程序

Bundler找不到gem的兼容版本,正在更新Rails应用程序
EN

Stack Overflow用户
提问于 2012-01-14 07:37:11
回答 4查看 29.7K关注 0票数 21

在遵循rails官方博客post创建了一个全新的rails应用程序后,尝试将应用程序转换为rails 3.2.0.rc2会产生以下结果

代码语言:javascript
复制
Updated Gemfile to depend on rails ~> 3.2.0.rc2
    gem 'rails', '~>3.2.0.rc2'
Updated Gemfile to depend on sass-rails ~> 3.2.3
    gem 'sass-rails',   '~> 3.2.3'

$ bundle install
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (3.1.1)

  In Gemfile:
    rails (~> 3.2.0.rc2) ruby depends on
      activesupport (= 3.2.0.rc2) ruby

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

$bundle update
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    coffee-rails (~> 3.1.1) ruby depends on
      railties (~> 3.1.0) ruby

    rails (~> 3.2.0.rc2) ruby depends on
      railties (3.2.0.rc2)

到底是什么问题呢?

系统规格:

Mac OS 10.7.2,Xcode 4.2.1,rvm 1.10.1,使用ruby 1.9.3p0 (2011-10-30修订版33570) x86_64-darwin11.2.0

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-01-17 13:14:20

我通过删除锁rm Gemfile.lock并再次运行bundle install解决了这个问题

代码语言:javascript
复制
$ rm Gemfile.lock
$ bundle install
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.0.4) 
Using activesupport (3.2.0.rc2) 
Using builder (3.0.0) 
Using activemodel (3.2.0.rc2) 
Using erubis (2.7.0) 
Using journey (1.0.0) 
Using rack (1.4.0) 
Using rack-cache (1.1) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.2) 
Using actionpack (3.2.0.rc2) 
Using mime-types (1.17.2) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.2.0.rc2) 
Using arel (3.0.0) 
Using tzinfo (0.3.31) 
Using activerecord (3.2.0.rc2) 
Using activeresource (3.2.0.rc2) 
Using bundler (1.0.21) 
Using coffee-script-source (1.2.0) 
Using execjs (1.2.13) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.4) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.2.0.rc2) 
Using coffee-rails (3.2.1) 
Using jquery-rails (2.0.0) 
Using rails (3.2.0.rc2) 
Using sass (3.1.12) 
Using sass-rails (3.2.3) 
Using sqlite3 (1.3.5) 
Using uglifier (1.2.2) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

这是一种非常暴力的解决问题的方法。如果这是一个已建立的项目,删除Gemfile.lock后可能会遇到其他问题,因为依赖版本不再被锁定。但是,如果这是一个新项目,采用这种方法不太可能遇到问题。

票数 64
EN

Stack Overflow用户

发布于 2012-01-14 07:53:15

除了sass-rails,你还需要升级你所依赖的coffee-rails版本(3.2.1应该可以做到)

票数 2
EN

Stack Overflow用户

发布于 2017-05-31 15:22:09

如果您的捆绑包版本与Gemfile.lock最后一行中捆绑的版本不同,则只有在将新gem添加到gem文件中之后,才会出现“找不到gem GEMNAME的兼容版本”的问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8858706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档