create spree extension无法激活rails-3.2.4 - activesupport版本冲突

时间:2013-08-17 12:24:31

标签: ruby-on-rails ruby ruby-on-rails-3.2 conflict spree

我是Ruby / Rails / Spree的新手,我正在尝试按照this tutorial创建一个简单的狂欢扩展。

我输入此命令:

spree extension simple_sales

并加入spree_simple_sales

我现在在此目录中输入的任何rails命令(例如rails -v)都会导致此错误:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate rails-3.2.4, because activesupport-4.0.0 conflicts with activesupport (= 3.2.14), actionpack-4.0.0 conflicts with actionpack (= 3.2.14), railties-4.0.0 conflicts with railties (= 3.2.14), activerecord-4.0.0 conflicts with activerecord (= 3.2.14), actionmailer-4.0.0 conflicts with actionmailer (= 3.2.14) (Gem::LoadError)
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:3:in `<class:Engine>'
    from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:2:in `<module:SpreeSimpleSale>'
    from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:1:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine/commands.rb:11:in `<top (required)>'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from script/rails:7:in `<main>'

我该怎么做才能解决这个问题?我在Win 7上,使用RailsInstaller安装Ruby 1.9.3。我有Rails 4.0.0和3.2.14,但我正在使用Rails 3.2.14和Spree。

更新 我发现如果我在rails命令前添加bundle exec,例如。 bundle exec rails -v它可以工作..但没有bundle exec的任何rails命令都会产生上述错误..但是为什么?为什么这个问题只发生在spree extension生成的目录?

1 个答案:

答案 0 :(得分:0)

您的错误很可能是因为您正在执行的rails命令是Rails 4,而您在扩展中使用的Gemfile和/或gemspec指定了rails 3.2.x(反之亦然)。

尝试使用以下命令运行相同的命令:

rails _3.2.4_ -v

在该目录中。


另请注意,Rails 3.2.4已经过时,存在多个安全漏洞。你应该尽快升级。