0
/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 `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.6/ext/json/ext/generator/gem_make.out

An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.

In Gemfile:

 coffee-rails was resolved to 3.2.2, which depends on 
        railties was resolved to 3.2.16, which depends on
          rdoc was resolved to 3.12.2, which depends on
            json

Getting this error while running rails s.How to resolve it

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
mkp24
  • 125
  • 1
  • 11
  • 1
    Possible duplicate of [Why won't bundler install JSON gem?](https://stackoverflow.com/questions/21095098/why-wont-bundler-install-json-gem) – webster Jan 29 '18 at 08:07
  • 1
    You have not installed all gems yet. `bundle install` broke along the way. Re-run `bundle install` and place the full error stack trace here. – Adim Jan 29 '18 at 08:11
  • on running gem install json -v '1.8.6'. getting an error: **ERROR: Error installing json: ERROR: Failed to build gem native extension.** current directory: /var/lib/gems/2.4.0/gems/json-1.8.6/ext/json/ext/generator /usr/bin/ruby2.4 -r ./siteconf20180129-18806-bb4juz.rb 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.4.0/gems/json-1.8.6 for inspection. Results logged to /var/lib/gems/2.4.0/extensions/x86-linux/2.4.0/json-1.8.6/gem_make.out** – mkp24 Jan 29 '18 at 08:29
  • ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /var/lib/gems/2.4.0/gems/json-1.8.6/tests/test_json.rb – mkp24 Jan 29 '18 at 08:34

1 Answers1

0

commenting the content of gemfile and updating ruby and rails to a latest stable version will solve most of the errors. for me I reinstalled ruby and rails using the steps provided at:

https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04

mkp24
  • 125
  • 1
  • 11