Spree commerce is one of the most popular e-commerce platforms for online store these days. It is based on Rails framework.

Let us make it ready on a windows machine. Here are the steps:

  1. Install MySQL.
  2. Install ImageMagick (make sure you tick the option – Install development headers and libraries for C and C++).
  3. Downloaded and install latest Railsinstaller.
  4. Copy libmysql.dll file from MySQL installation folder( find it ) and paste into RailsInstaller\Ruby2.x.x\bin folder. This will allow Ruby to connect to MySQL.
  5. We will be using 4.2.2 version of Rails here. Execute the following command:
    gem install rails -v 4.2.2
  6. Execute following command to install spree:
    gem install spree

    *Note: If you see error similar to this:

    Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate

    then, please follow the steps from this link:
    SSL upgrades on rubygems.org and RubyInstaller versions
    We need to put the downloaded certificate file at:

    C:\RailsInstaller\Ruby2.1.0\lib\ruby\2.1.0\rubygems\ssl_certs
  7. Now create a new rails project and give it name spree. Click here for steps.
  8. We will be using MySQL as our database. Create a new database named spree_store using phpmyadmin or any other UI tool like HeidiSql. Also create MySQL user named spree and password store and assign it to our database spree_store.
  9. Make sure Collation of your database should be set to utf8_general_ci
  10. Open your Gemfile and add the following line:
    gem 'mysql2', '~>0.3.1'
  11. Also, remove sqlite gem from the file.
  12. Now on command prompt, inside your project directory, execute
    bundle install
  13. On Windows, I found coffe-script latest gem version to crash spree. So, add the following line to your Gemfile:
    gem 'coffee-script-source', '1.8.0'
    

    and then execute

    bundle update
  14. Now open your config\database.yml file and make it look like this:
    default: &default
        adapter: mysql2
        database: spree_store
        username: spree
        password: store
        pool: 5
        timeout: 5000
    
    development:
        <<: *default
    
    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    
    test:
        <<: *default
    
    production:
        <<: *default
  15. Next to install spree, execute
    spree install .

    Enter yes for all question for now. During installation, enter email address and password for admin.

  16. Now spree should be ready on your system. Execute the command:
    rails server
  17. Now navigate to the url:
    http://localhost:3000