0

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:

rails was resolved to 4.2.6, which depends on

actionmailer was resolved to 4.2.6, which depends on
  actionpack was resolved to 4.2.6, which depends on
    actionview was resolved to 4.2.6, which depends on
      rails-dom-testing was resolved to 1.0.9, which depends on
        rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
          activesupport was resolved to 4.2.6, which depends on
            json

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

current directory: /tmp/bundler20180201-46774-s2jlm4json-1.8.6/gems/json-1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20180201-46774-16pojxx.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

what does this mean and how to correct it.I have already tried update and upgrade method is there any other ways to remove certain dependencies.

mkp24
  • 125
  • 1
  • 11
  • Try to running "bundle update" to see if it will solve the problem. – z atef Feb 01 '18 at 15:02
  • @zee returning same error as bundle install – mkp24 Feb 01 '18 at 15:04
  • What OS are you running. – z atef Feb 01 '18 at 15:08
  • This same issue has been answered here: https://stackoverflow.com/questions/4304438/gem-install-failed-to-build-gem-native-extension-cant-find-header-files – z atef Feb 01 '18 at 15:10
  • running ubuntu 17.04. While running **sudo apt-get install ruby2.3-dev** getting an error. The following packages have unmet dependencies: **ruby2.3-dev : Depends: libgmp-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.** – mkp24 Feb 01 '18 at 15:19
  • have you tried `sudo apt-get install libgmp3-dev` and then `bundle`? – Muhammed Anees Feb 01 '18 at 15:35
  • libgmp3-dev got broken dependencies trying to remove that nothing seems to work though. – mkp24 Feb 01 '18 at 16:11

2 Answers2

0

Try to update source list if necessary otherwise remove most of the files installed recently and then do a fresh install from the beginning. Installed each held packages separately if needed other wise

sudo apt-get uprade 

will also work.

mkp24
  • 125
  • 1
  • 11
0

Try this:

bundle update

In case of bundler error

gem install bundler  #After that run below command too.

bundle install
Pragya Sriharsh
  • 529
  • 3
  • 6