嗨,我是开发 Rails 应用程序的新手,我有兴趣在我的电子商务网站上使用“spree”。
我正在从这个网站 http://guides.spreecommerce.com/getting_started.html大肆学习本教程
我按照上面的教程进行了全新安装。我使用 rails 1.9.3 和 mysql 数据库完成了“5.1 启动 Spree”部分。一切都很好,直到我注意到登录栏没有像教程那样出现。
我做了一些研究,导致我在 https://github.com/railsdog/deface/issues/12中找到了这个解决方案, 我从这篇文章中了解到,问题似乎来自使用时污损 gem 中的“错误” ruby 1.9.3 ,但问题没有出现在 1.9.2 中,所以我将我的 ruby 版本更改为 1.9.2 进行尝试。
安装 ruby 1.9.2 后,我安装了“spree”gem,我从“入门教程”重复了该项目(使用 mysql 数据库)以完成教程。
现在在第 4.4.2 部分,我输入“rake db:create”终端输出这个
store$ rake db:create
store_test 已经存在
store_development 已经存在当我尝试通过“rails g spree:site”生成狂欢网站时,终端给了我这个错误
store rails g spree:site create config/spree.yml /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-0.70.2/lib/generators/spree/site/site_generator.rb:16:in `block in config_spree_yml': undefined method `version' for Spree:Module (NoMethodError) from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `call' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `render' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `open' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block in invoke!' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in `invoke!' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in `create_file' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-0.70.2/lib/generators/spree/site/site_generator.rb:15:in `config_spree_yml' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/task.rb:22:in `run' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:389:in `start' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/generators.rb:168:in `invoke' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/strong textrails/commands/generate.rb:12:in `<top (required)>' from /Usestrong textrs/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:240:in `require' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:240:in `block in require' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:223:in `block in load_dependency' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:640:in `new_constants_in' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:223:in `load_dependency' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.2/lib/active_support/dependencies.rb:240:in `require' from /Users/macbookpro/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/commands.rb:28:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'
我很困惑,因为我之前没有创建数据库(但它表明它存在)。现在我什至不能生成狂欢网站。我研究这个问题好几天了,还没有找到匹配的解决方案。这就是我的 Gemfile 的样子
来源“http://rubygems.org”
gem 'rails', '3.1.2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' # 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 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' group :test do # Pretty printed test output gem 'turn', '0.8.2', :require => false gem 'spree' , '0.70.2' end
如果有人可以为我的问题提供一些指示或解决方案,我将不胜感激。我现在很迷茫,它肯定会让某人开心。(如果您需要有关我的 ruby 环境的更多信息,请告诉我)