Monday, January 4, 2010

Spree rake db:bootstrap issue - stack level too deep

Ever had just a couple of minutes you wanted to burn and look at something new?  I did today and was hoping to have a quick look at Spree.  It's a Ruby on Rails e-commerce solution for developers to use in building e-commerce applications.  I ran across it last year and quickly passed it by as not having enough of what I needed at the time.  I'm back full circle looking at Spree again for an upcoming project and I decided it's come far enough that I'd look under the hood.  That's when my couple of minutes ran out quickly.  I'd like to say it's because I was doing something wrong or in someway caused the issue myself.  I'd like to say it's because I looked at Spree and just couldn't put it down because I liked it so much.  Unfortunately neither is true.

I'm running Rails 2.3.5 under Ruby 1.8.7 on Windows XP Pro.  Please, no cracks about Windows being my development environment and how that is wrong.  I had to wade through enough of those postings from over zealous Linux developers before I found some information I could use to solve the problem before me.

I was following the Spree Guide - "Getting Started with Spree" in the hopes I would accelerate my quick look. When I ran the rake db:bootstrap command I received and error.

"stack level too deep"

It appears that Spree has a dependency on a gem called jeweler which has a side affect dependency on Git.  It just so happens I have Git installed (use it all the time now) but I hadn't created a repository out of the "mystore" project (since I was just looking) so it was failing.  My quick way around the error was to just initialize a Git repository for this project.  If you don't have Git installed you might as well do that now.  It will save you time if you've decided to stay in the Ruby on Rails community.

After I got passed the "stack level too deep" I had to install a few more gems and then I hit another error.

"undefined method 'av_template_class' for Haml::Util:Module"

I didn't have Haml installed before I installed Spree.  It came along as a dependency.  Turns out the dependency has an issue.  If you hit this error Haml 2.2.16 isn't going to work for you so you'll need to downgrade the gem to 2.2.15.

gem uninstall haml
gem install haml -v 2.2.15

That should get you up and running on Spree 0.9.4 on Windows XP under Rails 2.3.5