1

I am trying to install json ruby gem on Windows 7 32 System.

The local environment details are

D:\Environment\DevKit32Ruby200>gem -v
2.0.14

D:\Environment\DevKit32Ruby200>ruby -v
ruby 2.0.0p451 (2014-02-24) [i386-mingw32]

D:\Environment\DevKit32Ruby200>rails -v
Rails 4.0.4

I have already tried following things

  1. Downgrading system ruby gems version to 2.3.0 using

    gem update --system 2.3.0
    
  2. I have done proper setting of devkit and manually I added proper ruby directory path in config.yml file.

    D:\Environment\DevKit32Ruby200>ruby dk.rb init
    
     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.
    
    D:\Environment\DevKit32Ruby200>ruby dk.rb install --force
        [WARN] Updating (with backup) existing gem override for                            'D:/Environment/ruby200new'
       [WARN] Updating (with backup) DevKit helper library for 'D:/Environment/ruby200new'
    
  3. I have also tried putting platform=ruby

    gem install json --platform=ruby --verbose
    

The error I am getting while installing json is bellow.

D:\Environment\DevKit32Ruby200>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

    D:/Environment/ruby200new/bin/ruby.exe extconf.rb
creating Makefile

make "DESTDIR="
generating generator-i386-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so

make "DESTDIR=" install
/usr/bin/install -c -m 0755 generator.so ./.gem.20170109-8336-qvgvzc/json/ext
make: execvp: /usr/bin/install: Permission denied
make: *** [install-so] Error 127


Gem files will remain installed in D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2 for inspection.
Results logged to D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2/ext/json/ext/generator/gem_make.out

There are 10's of questions are already tagged on this issue but none resolved. Kindly help me to identify whats missing and why the error coming.

Satishakumar Awati
  • 3,604
  • 1
  • 29
  • 50
  • Please check your 'config.yml' file generated by 'ruby dk.rb init' command and check for installed ruby version and path – Hardik Upadhyay Jan 09 '17 at 09:51
  • I manually added proper ruby directory path in config.yml and its no issue – Satishakumar Awati Jan 09 '17 at 09:57
  • Based on log it's look like issue is in ruby path but anyway try with gem install json --platform=ruby – Hardik Upadhyay Jan 09 '17 at 10:04
  • got this error : D:\APPS\LX_release7_JanPRD>gem install json --platform=ruby Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. – Satishakumar Awati Jan 09 '17 at 10:28
  • Why are you doing this btw? There must be a *very* good reason to offer bounty on making JSON compile on MINGW ^_^ – bbozo Jan 25 '17 at 17:21
  • I had faced the similar issue,i did run command, gem update --system 2.3.0 ,i hope this gem version would not make trouble for your rest of the gems. – Amit Agarwal Jan 26 '17 at 06:22
  • @Amit Agarwal thank you , I did already tried downgrading rubygem to 2.3.0 did not worked I mentioned in question as well. – Satishakumar Awati Jan 26 '17 at 06:47

2 Answers2

2

i386-mingw32 is a mountain of pain that'll never be fully supported, when I spent time on Windows I used to use a VirtualBox VM with ubuntu installed which shares a folder with the Windows host. I would edit the files with netbeans in windows and run the code in putty, the VM would basically be headless.

I actually did a lot of real work that way. If you want to do a "Hello World" rails app - OK - good luck even with that. How about an online development environment such as https://c9.io/ ?

But if you want to work, not just play around, set yourself up with an Ubuntu VM at the very least, or work in Ubuntu/MacOS at the very best.

bbozo
  • 7,075
  • 3
  • 30
  • 56
  • I second that. I also faced this error, and after a lot of unsuccessful attempts, I switched to Ubuntu. Things are running fine after that. – 31piy Jan 25 '17 at 17:32
0

Try this out:

Why don't you download the json .gem file from rubygems.org and install it directly using command

gem install json-x.x.x.gem
Sachin Singh
  • 7,107
  • 6
  • 40
  • 80