1

I'm having problems when I try to rake db:migrate. I get the following error:

Could not find json-1.7.5 in any of the sources  
Run `bundle install` to install missing gems.

Now, I've already run bundle install and it gave an error when it got to json, but I try it again anyway and get the same error when it gets to json:

Installing json (1.7.5) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb  /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot

load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from extconf.rb:1:in'

Gem files will remain installed in /home/chris/.bundler/tmp/2984/gems/json-1.7.5 for inspection. Results logged to /home/chris/.bundler/tmp/2984/gems/json-1.7.5/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.7.5), and Bundler cannot continue. Make sure that gem install json -v '1.7.5' succeeds before bundling.

The last part says to make sure gem install json -v '1.7.5' succeeds before bundling, so I run this command and json installs fine:

Building native extensions. This could take a while...
Successfully installed json-1.7.5
1 gem installed
Installing ri documentation for json-1.7.5...
Installing RDoc documentation for json-1.7.5...

But if I try rake db:migrate it starts all over again with the same errors. I've read about issues with json on Mac, but have had no luck with any of those solutions. Any ideas?

I'm running Ubuntu 12.04LTS, ruby 1.9.3, rails 3.2.8, gem 1.8.15 (tried it with 1.9.1 also)

cliff900
  • 135
  • 5
  • http://stackoverflow.com/questions/11058952/why-do-i-get-an-error-installing-the-json-gem-in-ubuntu – uday Nov 17 '12 at 02:31

1 Answers1

1

I think that you need to install the -dev package. Try running this command

sudo aptitude install ruby1.9.1-dev

and then bundle install should work.

avk
  • 994
  • 6
  • 13
  • Thanks avk. This worked. When looking for solutions I saw some threads that talked about installing DevKit, but that was for the Ruby Installer that is for Windows. I wonder why I couldn't find your solution anywhere else... seems simple enough. The ruby on rails guide at rubyonrails.org nor does the Agile Web Development with Rails book by Hansson mention this in setup, at least I didn't see it anywhere. Thanks again. – cliff900 Nov 17 '12 at 02:52
  • you are welcome! i had a similar issue some time back, weird but good that it has a solution :D – avk Nov 17 '12 at 03:49
  • The only thing I should add is that I used apt-get instead of aptitude since that is what I think is default. I'm new to Linux so I don't really know much about other options. – cliff900 Nov 17 '12 at 16:49