Spree Commerce安装错误,Bundler无法找到与"rails"宝石兼容的版本。

3

我按照这个指南安装Spree网站时(链接:http://guides.spreecommerce.com/getting_started.html),遇到了如下问题:

deploy@bothunter:~/rails$ sudo -i gem install rails
Successfully installed rails-3.2.1
1 gem installed
deploy@bothunter:~/rails$ sudo -i gem install bundler

Successfully installed bundler-1.0.22 1 gem installed
deploy@bothunter:~/rails$ sudo -i gem install spree
Successfully installed spree-1.0.0 1 gem installed
deploy@bothunter:~/rails$ rails new mystore -d mysql create
create README.rdoc
create Rakefile
create config.ru
.....

run bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using activemodel (3.2.1)
..... Using rack-test (0.6.1)
Using hike (1.2.1)
Using actionpack (3.2.1) ..... Using coffee-rails (3.2.2)
Using jquery-rails (2.0.0)
Using mysql2 (0.3.11)
Using rails (3.2.1)
Using uglifier (1.2.3)
Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

deploy@bothunter:~/rails$ cd mystore
deploy@bothunter:~/rails/mystore$ spree install
Would you like to install the default gateways? (yes/no) [yes]
... gemfile spree gemfile spree_usa_epay
gemfile spree_skrill run
bundle install from "."
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run bundle install precompiling assets

git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run bundle install

deploy@bothunter:~/rails/mystore$ bundle install
Updating git://github.com/spree/spree_usa_epay.git

Updating git://github.com/spree/spree_skrill.git
Fetching source index for sitename.com Bundler could not find compatible versions for gem "rails":
**In Gemfile:
spree_usa_epay (>= 0) ruby depends on rails (<= 3.1.3, >= 3.1.1) ruby

    **rails (3.2.1)**

deploy@bothunter:~/rails/mystore$

But...

deploy@bothunter:~/rails/mystore$ gem --list

rails (3.2.1, **3.1.3**)
railties (3.2.1, **3.1.3**)
rake (0.9.2.2, 0.9.2)

如何解决它?


1
不应使用 sudo -i 安装 gem。 - mpapis
我也有同样的问题。目前我正在使用rbenv来管理我的ruby版本,但考虑切换回RVM以便我可以控制我的gemsets,这样我就可以根据项目或其他需求来管理使用哪个rails gem了。 - Andre Dublin
你不应该使用sudo -i安装gem。 - Павел Иванов
sudo -i 是个不好的主意,它可能会改变环境和 gem 安装的位置。至于错误,你尝试按照提示运行 bundle install 了吗? - mpapis
@mpapis,我做到了(退出,su deploy...),但是: 在Gemfile中: spree_skrill(>=0)ruby依赖于 spree_core(>=0.70.1)ruby运行bundle update将从头开始重新构建您的快照,仅使用Gemfile中的宝石,这可能会解决问题。deploy@bothunter:~/rails/mystore$ bundle update 更新git://github.com/spree/spree_usa_epay.git 更新git://github.com/spree/spree_skrill.git 获取站点的源索引 Bundler无法找到与gem“rails”兼容的版本: 在Gemfile中: spree_usa_epay(>=0)ruby依赖于 rails(<=3.1.3,>=3.1.1)rubyrails(3.2.1) - Павел Иванов
在重新阅读问题后,我发现它要求进行“bundle install precompiling assets”和“bundle install”。 - mpapis
2个回答

5

Spree 1.0仅与Rails 3.1.3兼容。我们将在下一个Spree的次要版本中支持Rails 3.2。在此之前,请使用3.1.3,如下所示:

gem install rails -v 3.1.3

只想补充一下,在Gemfile中你也需要将版本更改为3.1.3。 - AMing

3

我相信问题出在rails版本上,它已经超出了spree的预期。因此,如果您通过以下方式创建新的rails应用程序,并使用3.1.3版本:

rails _3.1.3_ new my_app_name

那么您将解决此错误。然而,在那之后,我在bundle install期间又遇到了另一个错误,目前还未解决。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接