0

私は Rails を初めて使用し、Spree Commerce を試してみたいと思っていましたが、Spree をインストールしようとしたときにいくつかの問題に遭遇しました。Spree インストール ガイドに従っています。

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 ファイルから最後の 4 行のコードを削除しました)。

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>

これらすべてのエラーでどこから始めればよいかわかりません。これらのファイルをいじるのが怖いです。また、レールサーバーは他のレールアプリケーション(スプリー以外)でも正常に動作します。助けていただければ幸いです。

ありがとう、ロス

4

1 に答える 1

2

Rails on Windowsの使用経験が豊富なWindowsユーザーとして、多くの問題を回避し、VirtualBoxまたはVMwareを使用してUbuntu 12.04LTSvmをセットアップすることをお勧めします。Vagrantを使用すると、もう少し自動化できます。

そうは言っても、システムレベルで前提条件を満たしていることを確認します。

Ruby 1.9.3-p327を使用していない場合は、Ruby1.9.3-p327にアップグレードしてください。これはおそらく問題ではありませんが、いくつかの重要なセキュリティ修正が含まれています。

を実行して、rubygemsが最新であることを確認してくださいgem update --system

バンドラーとレーキが最新であることを確認してください:gem update bundlerおよびgem 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同じように付ける必要があります。そうしないと、間違ったgemが読み込まれ、不思議な頭痛の種になります。したがって、テストサーバーを実行するための適切なコマンドはbundle exec rails sです。

それがどのように機能するかをご覧ください。

于 2012-12-08T20:31:16.060 に答える