ERROR: Error installing json: ERROR: Failed to build gem native extension - ruby

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>

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'

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.

To help you here are some steps to follow in order to install your gem locally:
Download json-1.8.3.
Place the downloaded gem into a folder called gems
Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
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".
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:
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):

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

If you installed Rails through RailsInstaller, try this -
https://gist.github.com/luislavena/f064211759ee0f806c88
It's a pretty common bug for RailsInstaller currently.

Related

Error Installing Jekyll in Cygwin

So I attempted to install Jekyll on Windows through Cygwin and I encountered an error when I tried to install Jekyll through Cygwin. Here is the output.
Michael#X556UAK: ~$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby.exe -r ./siteconf20171011-7692-lgoixq.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi- 1.9.18 for inspection.
Results logged to /c/Users/Michael/.gem/ruby/2.3.0/extensions/x86_64-cygwin/2.3.0/ffi-1.9.18/gem_make.out
I conducted some research online and I wasn't able to find a solution. I tried running Cygwin as an administrator and I still got that error message.
What can I do to fix this issue?
I had the same issue when installing Jekyll and Ruby in the Windows 10 Bash Linux Subsystem. It turned out, that the development package from Ruby was missing. I had to install it first:
sudo apt-get install ruby2.4-dev
In my case. Try to install the dev package in Cygwin package manager, in your case its version 2.3.
Andy
For the record, I encountered the same problem Michael did, and installing the ruby-devel package (using the Cygwin Setup installer) solved my problem. A missing *-devel Cygwin package is a common cause of errors about missing header files.

Jekyll with Ruby 2.3 on macOS 10.13 (HighSierra)

When I run $ jekyllor $ jekyll serve it raises the following error:
-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
I checked /System/Library/Frameworks/Ruby.framework/Versions/ and Version 2.0 does not exist. It turns out that on the same day I updated on HighSierra, Version 2.3 was installed.
I think Jekyll still looks for Version 2.0. So how can I tell Jekyll to use Ruby 2.3?
Edit:
When I uninstall and then install jekyll, it fails:
$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20171111-1004-fgop80.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/ffi-1.9.18/gem_make.out
Solution:
I googled can't find header files for ruby and it turned out that "Command Line Tools for Xcode" must be installed which you can download here: https://developer.apple.com/download/more/
However, I have macOS 10.13 and there is no command line tools for Xcode 8.x (which was the latest version I could install). That's why I searched for Xcode in the Mac App Store and installed Xcode 9. Once, it was installed, a window popped up that said "git requires command line tools. Do you want to install it?". I clicked install and still failed to run $gem install jekyll.
Then I tried $ brew doctor. There were some warnings which I fixed one by one and finally I'm able to run $ gem install jekyll.
I had the same issue. I just uninstalled jekyll
gem uninstall jekyll
and then installed it again.
gem install jekyll
Then it worked again.

installation of jekyll failed - Windows

I am trying to install jekyll on a 32 bit windows 7 PC . I downloaded ruby installer-32 bit and 32 bit devkit and extracted un ruby install folder.i got some ssh error which i resolved by temporarily switching to http instead of https and then updated gems as well as installed bundler using
gem install bundler
however gem install jekyll gives following error
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe -r ./siteconf20150109-5804-1k3wbva.rb extconf.rb
No such file or directory - C:/Ruby21/bin/ruby.exe -r ./siteconf20150109-5804-1k
3wbva.rb extconf.rb 2>&1
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/fast-stemm
er-1.0.2 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/fas
t-stemmer-1.0.2/gem_make.out
You need to install the Ruby DevKit to fix the error you're seeing. Any sane Ruby install has the ability to build stuff on the fly.
I would start with Julian Thilo's awesome instructions for installing Jekyll on Windows:
Run Jekyll on Windows
If you are installing Ruby only for the purpose of running Jekyll, PortableJekyll will give you a full working Jekyll install in < 5 minutes.
Happy Jekylling...
I tried the same thing on 3 systems and found out that installing ruby gems fixed the issue .. so for anyone coming back at this question , this is how you install jekyll on a windows pc:
1.download and install ruby.
2.download devkit extract in to a folder(preferably inside ruby installation dir) and type in cmd window while in your devkit dir :
ruby dk.rb init
ruby dk.rb install
3.download and install gems by
ruby setup.rb
4. finally :
gem install bundler
gem install jekyll
*bundler is a jekyll dependency
I had the same issue on Windows 10 after installing Ruby+Devkit 2.5.X (x64) with the Windows installer.
The reason was that I changed the default path in the installer and had spaces in the path name. Apparently some make scripts do not like that.
Reinstalling to a path without any spaces fixed the issue.
Also see this related issue on github.
I failed to install "gem install jekyll bundler" when ruby was installed in "c:\program files\Ruby26-x64". After I reinstalled ruby on c:\Ruby26-x64 everything went ok. Seems like installation fails to parse path with blank

Installation issue in sproutcore

I was installing Sproutcore while installation I was facing issue saying that "Error installing Sproutecore: The 'http_parser.rb' native gem requires installed build tools. Please update your PATH to include build tool...".
Check below screenshot of my command prompt.
I thought this error generate because I didn't set ruby path in environment variable but after setting up path I am facing same error. Please advise.
I follow this link to install sproutcore.
Install This DevKit:
https://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
after installation go to devkit dir and run this following command
ruby dk.rb init
ruby dk.rb install
gem install rdiscount --platform=ruby

Using RubyGems on ubuntu server

I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...
If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.

Resources