Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations

Jack McDowell
Jack McDowell
37,797 Points

Error when running bundle install (active record basics) on WinX64

When I did the Build a to-do List course I used the Treehouse VM, so everything worked fine. For this project I'm trying to use my OS environment and things are not working. I've followed the installing Ruby on windows video but I'm still getting an error when creating the project files.

I'm running ruby 2.2.2p95 [x64-mingw32] on Windows 8.1 x64. The error is as follows:

Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150515-4796-t7q37e.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127

make failed, exit code 2

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.2 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.

I guess if worse comes to worse I could go back and use the tree-house VM? Anyway, any help would be appreciated.

Oh and running "gem install json -v '1.8.2'" as the console suggests gives this error:

Ī» gem install json -v '1.8.2'
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150515-8588-1ooq4lv.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127

make failed, exit code 2

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.2 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.2/gem_make.out

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

1) The 64-bit version of Ruby has some issues, so you should use 32-bit version, even if your system is 64-bit.

2) You should not use Windows for Rails development in general. Too many problems, not enough help online, since most Rails developers don't use Windows (I've never seen a single one). Try Ubuntu on dual boot or through free VMWare Player.

Jack McDowell
Jack McDowell
37,797 Points

Thanks Maciej Czuchnowski, I was just reading about the Ruby x64 problems with dependencies and not using windows for development versions. It seems that the common suggestions to these problems is to use Linux. Unfortunately my laptop has a UEFI bios so installing Ubuntu there will be a challenge in and of itself.

Thanks for the suggestions.

I'll leave this question open a little bit longer to see if anyone else has some input.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Sure thing. If you can't do dual boot, then just install VMWare Player, create a virtual machine and install Ubuntu on it. It's a perfect development environment once you set it up. I used it for at least one year before I moved to a dedicated Ubuntu machine. You can also develop online in your browser for free through Nitrous.io or Cloud9.

Jack McDowell
Jack McDowell
37,797 Points

A cloud based solution seems interesting. I bet I could install rails on my web-host and play around with it there!

Anyway, for the time being I think I'll use the treehouse VM that should have everything set up correctly and install Ubuntu and set up my web-host later.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Yeah, treehouse VM is also based on Ubuntu and should be fine, although I never tried it because I had VMWare installed already ;).

http://www.aptana.com/products/studio3/download.html this is also an option for using windows to web development of rails and other programming needs. Supports 64 bit. basically it is a environment package that allows you to easily set up your environment automatically. Try it. you can always uninstall if you don't like it. I had a bunch of issues myself setting up rails environment. This was an easy fix for me. I also have duel boot option using Ubuntu as the previous answer suggested. Anyway hope this helps. Just a side note if you follow the above answer advise. You have option to set up a virtual box using windows in your Ubuntu environment. So you can easily switch to windows application while using Ubuntu without the need to restart computer. Have a great day.