Issue with Ruby gem install - ruby-on-rails

I am trying to install json on windows as follows, but its not working. Please help me with possible resoultion for the same.
C:\Ruby193\bin>gem install --local json-1.8.1.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json-1.8.1.gem:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe -r ./siteconf20140725-4216-11o740j.rb extconf.rb
creating Makefile
make clean
Makefile:165: *** target pattern contains no `%'. Stop.
make
Makefile:165: *** target pattern contains no `%'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/json-1.8.1/gem_make.out

RubyGems 2.4.1 will not build native extensions in Ruby version 1.9.3 and earlier on Windows.
You will need to downgrade RubyGems to 1.8.29.
To do this run the following command:
gem update --system 1.8.29
Check gem version:
gem -v
1.8.29
Now try your command again:
gem install --local json-1.8.1.gem
ref: https://groups.google.com/forum/#!topic/rubyinstaller/k19SeJijpKU/discussion

Related

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 json on windows 8.1

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.

Error Installing JSON 1.8.1 via RubyGems

My OS is Windows 7 64x Ultimate. I try to install the json gem like this:
gem install json -v '1.8.1'
But I have a problem:
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.
C:/Ruby193/bin/ruby.exe -r ./siteconf20150220-2012-1uff8mn.rb extconf.rb
creating Makefile
make clean
Makefile:165: *** target pattern contains no `%'. Stop.
make
Makefile:165: *** target pattern contains no `%'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.
1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/js
on-1.8.1/gem_make.out
How can install json 1.8.1?
This seems to be a known bug with Rubygems. Take a look at the issue page for this bug over on github.
It has not yet been fixed but will hopefully be fixed soon. For now, it seems most people have to downgrade to rubygems 2.3.0 to get it to work on Windows. That should solve your problem.
You have to update your ruby gem to the newest version
To check what your ruby in now
$Ruby -v
Update it to ruby version 2.3.7
$rvm list known
$rvm install 2.3.7
$rvm use 2.3.7 --default
$gem install bundler
Check out this video https://www.youtube.com/watch?v=lsNXc3uQ2AA&lc=z22pvls4asawvhi5004t1aokgq0e4p2vb1qpp3w3z252bk0h00410.1528974099408204
Let me know if does that help!

ERROR: Failed to build gem native extension when installing rails

I'm on windows and trying to install rails. but I get the following error message:
Z:\AlexL\My Documents\rails>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe -r ./siteconf20150211-3312-5ie7vd.rb extconf.rb
creating Makefile
make clean
Makefile:165: *** target pattern contains no `%'. Stop.
make
Makefile:165: *** target pattern contains no `%'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.
2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/js
on-1.8.2/gem_make.out
Ruby version is:
ruby 1.9.3p484
I've got this devkit installed DevKit-tdm-32-4.5.2-20111229-1559-sfx
in this folder:
C:\Ruby193\DevKit\
Not sure what else is wrong?
Looks the same as the issue being discussed here.
Apparently, there is a problem with Ruby 1.9.3 and newer RubyGems versions on Windows machines. Their quick-fix solution was to downgrade to an earlier version of RubyGems.
gem update --system 1.8.29
Once you have done that, confirm that gems -v returns 1.8.29 and try your command again.
Otherwise, you can upgrade to Ruby 2.X, which should also resolve this problem.

Cant run rails server

I am just getting started with ruby on rails, after installing rails executing many commands on the console, i tried to run rails server with the command rails server but gets an error about not loading coffee-rails, i tried the command gem install coffee-rails i got
gem install coffee-rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing coffee-rails:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe -r ./siteconf20140724-4244-v083ym.rb extconf.rb
creating Makefile
make clean
Makefile:165: *** target pattern contains no `%'. Stop.
make
Makefile:165: *** target pattern contains no `%'. Stop.
make failed, exit code 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.
1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/js
on-1.8.1/gem_make.out
RubyGems 2.4.1 will not build native extensions in Ruby version 1.9.3 and earlier on Windows.
You will need to downgrade RubyGems to 1.8.29.
To do this run the following command:
gem update --system 1.8.29
Check gem version:
gem -v
1.8.29
Now try your command again:
gem install coffee-rails
ref: https://groups.google.com/forum/#!topic/rubyinstaller/k19SeJijpKU/discussion
Take a look at this answer - they seem to have had the same trouble and had to use an older version of make.

Resources