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

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Can't install Testapp (Ubuntu 14.04) | json 1.8.2 problem

I'm stuck here:

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

/usr/bin/ruby2.1 extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20150405-27483-1v0hhhq/json-1.8.2/gems/json-1.8.2 for inspection. Results logged to /tmp/bundler20150405-27483-1v0hhhq/json-1.8.2/extensions/x86_64-linux/2.1.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've tried to install son -v '1.8.2 but it just won't work. Any help?

3 Answers

Devin Scheu
Devin Scheu
66,191 Points

Maybe because you wrote son, not json?

uups, well spotted. But I've typed that wrong here, bus correct on the console.

This is what the result looks like:

max@max-ThinkPad-T400:~/projects$ sudo gem install json -v '1.8.2' Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/json-1.8.2 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/json-1.8.2/gem_make.out

Worked after doing this: in my case (Ubuntu 14.04) that didn't work directly and I had to do this:

$ sudo apt-get install ruby-dev

and then I could install the gem and continue. Had one more problem that was fixed by:

$ sudo apt-get install libsqlite3-dev

Hope that helps anyone who encounters the same problem.