Spree设置错误:设计Github Gem'spree_auth_devise'& Rails服务器

时间:2012-12-08 12:13:46

标签: ruby-on-rails github devise gem spree

我是Rails&的新手我想尝试使用Spree Commerce,但在尝试安装Spree时遇到了一些问题,我一直在关注 Spree installation guide

当我尝试安装Spree时,我收到以下错误:

C:\Users\Ross\Documents\eCommerce\Spree\test_spree_store>spree install
Would you like to install the default gateways? (yes/no) [yes] y
Would you like to install the default authentication system? (yes/no) [yes] y
Would you like to run the migrations? (yes/no) [yes] y
Would you like to load the seed data? (yes/no) [yes] y
Would you like to load the sample data? (yes/no) [yes] y
     gemfile  spree
     gemfile  spree_usa_epay
     gemfile  spree_skrill
     gemfile  spree_auth_devise
         run  bundle install from "."
←[31mYou passed :github as an option for gem 'spree_auth_devise', but it is invalid.←[0m

C:\Users\Ross\Documents\eCommerce\Spree\test_spree_store>

以下是我的应用程序Gem文件:

source 'https://rubygems.org'

gem 'rails', '3.2.9'

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

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

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

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'spree', '1.2.2'
gem 'spree_usa_epay'
gem 'spree_skrill'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-2-stable'

我尝试再次运行spree install而不接受默认的身份验证设置(N.B.我先从我的gem文件中删除了最后四行代码)。

C:\Users\Ross\Documents\eCommerce\Spree\spree_test>spree install
Would you like to install the default gateways? (yes/no) [yes] y
Would you like to install the default authentication system? (yes/no) [yes] n
What is the name of the class representing users within your application? [User] y
Would you like to run the migrations? (yes/no) [yes] y
Would you like to load the seed data? (yes/no) [yes] y
Would you like to load the sample data? (yes/no) [yes] y
     gemfile  spree
     gemfile  spree_usa_epay
     gemfile  spree_skrill
         run  bundle install from "."
      create  config/initializers/spree.rb
      create  config/spree.yml
      remove  public/index.html
      append  public/robots.txt
      create  app/assets/javascripts/store
      create  app/assets/javascripts/admin
      create  app/assets/stylesheets/store
      create  app/assets/stylesheets/admin
      create  app/assets/images/store
      create  app/assets/images/admin
      create  app/assets/javascripts/store/all.js
      create  app/assets/javascripts/admin/all.js
      create  app/assets/stylesheets/store/all.css
      create  app/assets/stylesheets/admin/all.css
      create  app/overrides
      append  config/environment.rb
      append  db/seeds.rb
     copying  migrations
    creating  database
     running  migrations
     loading  seed data
        rake  db:seed
rake aborted!
wrong constant name y
C:/Users/Ross/Documents/eCommerce/Spree/spree_test/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
     loading  sample data
      insert  config/routes.rb
**************************************************
We added the following line to your application's config/routes.rb file:

    mount Spree::Core::Engine, :at => '/'
**************************************************
Spree has been installed successfully. You're all ready to go!

Enjoy!

即使耙子已经中止,它似乎也能正常工作?但是,当我试图运行服务器时,它无法正常工作。我收到了以下错误:

C:\Users\Ross\Documents\eCommerce\Spree\spree_test>rails s
=> Booting WEBrick
=> Rails 3.2.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `const_defined?': wrong constant name y (NameError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `block in constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_core-1.2.2/lib/spree/core.rb:53:in `user_class'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/app/models/spree/promotion/rules/user.rb:7:in `<class:User>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/app/models/spree/promotion/rules/user.rb:4:in `<module:Rules>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/app/models/spree/promotion/rules/user.rb:3:in `<class:Promotion>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/app/models/spree/promotion/rules/user.rb:2:in `<module:Spree>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/app/models/spree/promotion/rules/user.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:469:in `load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:469:in `block in load_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:639:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:468:in `load_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:353:in `require_or_load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:502:in `load_missing_constant'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:192:in `block in const_missing'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:190:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:190:in `const_missing'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spree_promo-1.2.2/lib/spree/promo/engine.rb:45:in `block in <class:Engine>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from C:/Users/Ross/Documents/eCommerce/Spree/spree_test/config/environment.rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
        from C:/Users/Ross/Documents/eCommerce/Spree/spree_test/config.ru:4:in `block in <main>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
        from C:/Users/Ross/Documents/eCommerce/Spree/spree_test/config.ru:1:in `new'
        from C:/Users/Ross/Documents/eCommerce/Spree/spree_test/config.ru:1:in `<main>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/server.rb:46:in `app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/server.rb:70:in `start'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:55:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

C:\Users\Ross\Documents\eCommerce\Spree\spree_test>

我不知道从哪里开始所有这些错误&amp;我害怕搞乱这些文件,rails服务器在其他rails应用程序中运行良好(非狂欢)任何帮助都会非常感激。

谢谢, 罗斯

1 个答案:

答案 0 :(得分:2)

作为一名在Windows上使用Rails有相当多经验的Windows用户,我建议您使用VirtualBox或VMware来节省许多麻烦并设置Ubuntu 12.04 LTS vm。 Vagrant可以让你更加自动化。

那就是说,我确保你满足系统级别的先决条件。

如果您不使用Ruby 1.9.3-p327,请升级到它。这不太可能是问题,但它包含一些重要的安全修复程序。

通过运行gem update --system确保rubygems是最新的。

确保捆绑器和佣金最迟为:gem update bundlergem update rake。如果你今天不安装狂欢宝石,那么你也可以使用狂欢宝石。

现在开始使用新项目:

rails _3.2.9_ new spree_project [-d mysql if you're using mysql]
cd spree_project
spree install

每当你在项目中运行任何rake或rails命令时,你必须在bundle exec前面加上它们,否则错误的宝石会被加载并导致你神秘的头痛。因此,运行测试服务器的正确命令将是bundle exec rails s

了解这对您有何帮助。