Error installing json on windows 8.1 - ruby-on-rails

I have installed rails 4.2.3 and ruby 2.2.2p95 on windows 8.1 x64 . When I try to run "bundle install" the installation fails because of json -v 1.8.3. I already have json version 1.8.1 installed. When I run rubygems update command it does not get updated. If I try to individually run gem install json -v 1.8.3 or gem install json --platform=ruby --version=1.8.3 I get the following error.
ERROR: While executing gem ... (OptionParser::InvalidArgument)
invalid argument: -platform=ruby
C:\>gem install json --platform=ruby --version=1.8.3
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150719-4308-1m86usl.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127
make failed, exit code 2
Gem files will remain installed in C:/Ruby22- x64/lib/ruby/gems/2.2.0/gems/json-1
.8.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/json-1.8.3/gem_make.out

Looks like you might have the 32-bit DevKit installed instead. Try uninstalling the DevKit you have and downloading and re-installing the latest 64-bit one. For more detail check out this similar answer:
https://stackoverflow.com/a/16579088/4034665

Try this gem install --verbose json -v 1.8.3. This should install the gem.

Related

ERROR: Error installing racc: ERROR: Failed to build gem native extension

Ubuntu 20.04.2 LTS
Installing Rails 6.1.3.1
Ruby: 2.6.5
Installing rails:
gem install rails -v 6.1.3.1 --no-doc
Fails to install racc-1.5.2
Trying to manually install racc-1.5.2:
gem install racc -v '1.5.2' --source 'https://rubygems.org/' --no-doc
produces the same error.
The following is an 'edited' output of the error:
$ gem install rails -v 6.1.3.1 --no-doc
Fetching racc-1.5.2.gem
Fetching zeitwerk-2.4.2.gem
...
Successfully installed rack-2.2.3
Successfully installed rack-test-1.1.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
/home/user/.rvm/rubies/ruby-2.6.5/bin/ruby -I /home/user/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210503-658786-pkp97m.rb extconf.rb
checking for rb_ary_subseq()... yes
creating Makefile
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR=" clean
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR="
compiling cparse.c
linking shared-object racc/cparse.so
current directory: /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2/ext/racc/cparse
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.-.racc.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/user/.rvm/gems/ruby-2.6.5#gemset/gems/racc-1.5.2 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.6.5#gemset/extensions/x86_64-linux/2.6.0/racc-1.5.2/gem_make.out
The main problem here is that the command mkdir is being called at a specific location, and it's just not there:
make: /usr/bin/mkdir: Command not found
To fix this, you need to add a symbolic link to that location:
$ sudo ln -s /bin/mkdir /usr/bin/mkdir
Run gem install again on rails and all should be good!
Thanks to user dem1tris from brining up a related topic, and providing the answer: make: /usr/bin/mkdir: Command not found during `gem install nokogiri` in Ubuntu 20.04

While installing http_parser.rb ERROR: Failed to build gem native extension

This error occurs when I try to install http_parser using gem:
dongl_000#LENNY ~/ava-home (master)
$ gem install http_parser.rb -v '0.6.0'
Building native extensions. This could take a while...
ERROR: Error installing http_parser.rb:
ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160217-15056-1hoiyfc.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
make: *** No rule to make target '/c/Ruby22-x64/include/ruby-2.2.0/ruby.h', need
ed by 'ruby_http_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/http_p
arser.rb-0.6.0 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/http_parser.rb-0.6.0/gem_make.out
How can I resolve this issue?
Versions
ruby : 2.2.1
rubyGem : 2.4.5
I was going through this very same issue.
Looked up the Git Repository for the Gem (HTTP_Parser) and found out the reason for my problem:
HTTP_Parser currently doesn't not support a Path with spaces
So I renamed my path and solved it.
To resolve attempt to add the devkit to Ruby like this:
Install Ruby+DevKit from RubyInstaller: Ruby Window Installers
Downloads
Check the "ridk install" checkbox at the end of the installer.
When RIDK runs, pick option 3 to install both MSYS and MINGW dev tools (make is provided with the MINGW stuff).
Open a fresh console (to get fresh environment variables), and rerun your gem or bundle command...and hope for the best.

Error installing rails 4 in mac

I am trying to set up rails in my mac(Yosemite) machine. But when I do
gem install rails
I get the following error. Please help.
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/Paa/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
creating Makefile
make clean
make
compiling generator.c
make: /usr/local/opt/gcc46/bin/gcc-4.6: No such file or directory
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Paa/.rvm/gems/ruby-1.9.3-p547/gems/json-1.8.2 for inspection.
Results logged to /Users/Paa/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/json-1.8.2/gem_make.out
What am I missing here.??
I think rvm might be trying to use gcc 4.6, which doesn't work properly with rvm. I believe you can:
Uninstall gcc 4.6 (brew rm gcc46)
Pull the latest rvm (rvm get stable)
Retry gem install rails

Rails – Bundle install problems with json

I'm running OS X Mavericks, with Rails 3.2.12. When I try to do rails new project, it gets stuck at bundle install.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
I get the same error when I do 'gem install json....' as it suggests. I've installed the latest version of Xcode, with the command line tools. When I do:
which gcc
I get:
/usr/bin/gcc
I'm new to all this stuff really, so please try to keep things simple.
So, prior to XCode 5, there was a gcc-4.2 binary, which got removed in the upgrade.
I found this tutorial helpful in getting gcc-4.2 back and running with ruby. It assumes that you're using homebrew to manage packages on your Mac.

Error installing rails, failed to build gem native extension

I know there is a couple of topics about that, but the reason I create a new one is that it still doesn't work for me ...
So here is my configuration :
ruby -v : 1.8.7
gem -v : 1.8.21
And when I try to make
sudo gem1.8 install rails
I have the following error :
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: make: not found
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.6.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.6.6/ext/json/ext/generator/gem_make.out
I'm running on Debian 6.0.4 Squeeze.
Thanks in advance for your answers !
You don't have make command, as your output says. In debian install package build-essential
I think gcc or c-compiler isn't install or not writen in environment path, I've got same problem while installing rails, but after Install gcc, I can install rails very well.

Resources