6

I am trying to install gem json and getting error for json.

I'm running:

  • Windows 8.1 (64 bit)
  • Ruby: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
  • gem: 1.8.2

D:\GIT\calabash>gem install json -v '1.8.3'
Building native extensions.  This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out

D:\GIT\calabash>
Kedar
  • 137
  • 1
  • 2
  • 5
  • [JSON is already bundled with 1.9.3.](http://ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/index.html) Why are you trying to reinstall it? Why not install a current and supported version of Ruby instead? – the Tin Man Jun 30 '15 at 15:38

5 Answers5

3

Its a late response, but may it helps someone else. to install json '1.8.3' it requires packages 'libgmp3-dev'.

Use following steps:

sudo apt-get install libgmp3-dev

gem install json -v '1.8.3'
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
1

To help you here are some steps to follow in order to install your gem locally:

  1. Download json-1.8.3.
  2. Place the downloaded gem into a folder called gems
  3. Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
  4. cd to the gems folder. If the path to the folder is C:\Desktop\gems, write the command: cd C:\Desktop\gems then click "Enter".
  5. To install the gem run the following command:

    gem install --local json-1.8.3.gem
    

I tried it and it worked for me, hopefully it will work for you.

Result: enter image description here


Second way:

Include the whole path of the gem in the command:

gem install --local C:\Users\kedarl\Desktop\T\json-1.8.2.gem

For me here is the result. (This time with the json-1.8.2.gem):

enter image description here

ZzZombo
  • 1,082
  • 1
  • 11
  • 26
Mourad
  • 474
  • 4
  • 10
  • 1
    it show another error i.e. C:\Users\kedarl\Desktop\T>gem install --local json-1.8.3.gem Building native extensions. This could take a while... The system cannot find the path specified. ERROR: Error installing json-1.8.3.gem: ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb creating Makefile Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8. 3 for inspection. Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/ge nerator/gem_make.out – Kedar Jun 30 '15 at 14:10
  • Is Devkit installed in your machine – Mourad Jun 30 '15 at 14:12
  • Yes. C:\Devkit>ruby dk.rb init [INFO] found RubyInstaller v1.9.3 at C:/Ruby193 Initialization complete! Please review and modify the auto-generated 'config.yml' file to ensure it contains the root directories to all of the installed Rubies you want enhanced by the DevKit. C:\Devkit>ruby dk.rb install --force [INFO] Updating convenience notice gem override for 'C:/Ruby193' [INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb' – Kedar Jun 30 '15 at 14:19
  • I updated devkit\bin path and -> C:\Users\kedarl\Desktop\T>gem install --local json-1.8.3.gem Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... The system cannot find the path specified. ERROR: Error installing json-1.8.3.gem: ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb creating Makefile Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8. 3 for inspection. Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/ge nerator/gem_make.out – Kedar Jun 30 '15 at 14:34
  • I believe it is a problem of devkit version which one are you installing in your machine – Mourad Jun 30 '15 at 14:37
  • Devkit Version : DevKit-tdm-32-4.5.2-20111229-1559-sfx which version is recommended? tried second way too, but observation is same. I only set a single devkit path in user variable Path "C:\Devkit\bin" – Kedar Jun 30 '15 at 14:38
  • That is the same version i have and it is the one that goes with ruby1.9.3, all that you can do now is delete that version and try to install it again follwing these steps:http://jekyll-windows.juthilo.com/1-ruby-and-devkit/ – Mourad Jun 30 '15 at 14:42
1

For anyone who has this issue on Sierra, I solved the problem through this thread: https://teamtreehouse.com/community/installing-ruby-on-mac-got-error

Coles notes version is that after updating to most recent version of XCode, I had to accept the terms for the XCode command line tools. See them/agree to them by running:

gcc --version

After I did that, everything installed as expected.

Kidcompassion
  • 91
  • 1
  • 7
0

I've solved this by installing Command Line Tools Xcode of the version I have. I hope this helps someone else.

Nawfal Haddi
  • 89
  • 1
  • 5
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 15 '22 at 13:44
-1

If you installed Rails through RailsInstaller, try this -

https://gist.github.com/luislavena/f064211759ee0f806c88

It's a pretty common bug for RailsInstaller currently.

Alexander Tekle
  • 65
  • 5
  • 13