【问题标题】:Spree set up errors: Devise Github Gem 'spree_auth_devise' & Rails ServerSpree 设置错误:设计 Github Gem 'spree_auth_devise' & Rails Server
【发布时间】:2012-11-26 11:21:23
【问题描述】:

我是 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(注意,我首先从我的 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>

我不知道从哪里开始处理所有这些错误,并且害怕弄乱这些文件,而且 rails 服务器在其他 rails 应用程序中也能正常工作(非狂欢),任何帮助将不胜感激。

谢谢, 罗斯

【问题讨论】:

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


    【解决方案1】:

    作为一个在 Windows 上使用 Rails 有相当多经验的 Windows 用户,我会敦促您省去很多麻烦,并使用 VirtualBox 或 VMware 设置一个 Ubuntu 12.04 LTS vm。 Vagrant 可以让你更加自动化。

    也就是说,我会确保您满足系统级别的先决条件。

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

    通过运行 gem update --system 确保 ruby​​gems 是最新的。

    确保 bundler 和 rake 是最新的:gem update bundlergem update rake。如果您不是今天才安装它,那么您也可以在使用它的同时执行 spree gem。

    既然您是最新的,就从一个新项目开始:

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

    每当您在项目中运行任何 rake 或 rails 命令时,您也必须在它们前面加上 bundle exec,否则可能会加载错误的 gem,这会给您带来莫名其妙的头痛。所以运行测试服务器的正确命令是bundle exec rails s

    看看这对你有什么作用。

    【讨论】:

    • 感谢您标记答案。您还可以在 freenode irc 组#spree 中获得帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-30
    • 1970-01-01
    相关资源
    最近更新 更多