gem install json --platform=ruby failed windows 7 64 bit - ruby-on-rails

I'm following the DevKit to get json gem to install. However it has not worked for me. This has been preventing me to do bundle install. Computer is Win 7 64 bit. Commands for ruby dk.rb init and ruby dk.rb install passed.
ruby 2.1.8p440 (2015-12-16 revision 53160) [x64-mingw32]
Rails 4.2.6
Error
>gem install json --platform=ruby
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:
ERROR: Failed to build gem native extension.
current directory: C:/ruby/lib/ruby/gems/2.1.0/gems/json-1.8.3/ext/json/ext/
generator
C:/ruby/bin/ruby.exe -r ./siteconf20160413-5616-jod3h4.rb extconf.rb
creating Makefile
extconf failed, exit code 1
Gem files will remain installed in C:/ruby/lib/ruby/gems/2.1.0/gems/json-1.8.3 f
or inspection.
Results logged to C:/ruby/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/json-
1.8.3/gem_make.out

Check are you getting the proper ruby version in the file after doing ruby dk.rb init, if not specify the proper ruby version as in the program files, then try to run ruby dk.rb install, once this is done devkit is installed and you can install the required gem.

Related

error installing rails on ubuntu 16.04 failed to build gem native extension

Here is the code I put in and then the error followed: I am currently figuring out rails headers and see what could be happening. I follwed this article https://gorails.com/setup/ubuntu/16.04
and this article: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
and nothing.
gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
rickus#rickus:~$ sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170928-18941-1fdewid.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.8.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.1/gem_make.out
Im also come up with this issue where I installed ruby environment manager rvm/ rbenv using sudo command.you can reinstall your ruby environment manager and avoid using sudo command or else all your gem installations would need sudo commands which you should avoid to prevent conflicts in the future.

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!

Moved DevKit to a different directory. How do I make it work again?

I know it said not to move it, but after I did ruby dk.rb init and ruby dk.rb install I moved it to a different directory because I didn't want it to clutter the directory it was in. I was able to gem install json before, but now when I try to test if it works by running gem install json --platform=ruby I get the following error:
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:/Ruby200-x64/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR="
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.1/ext/jsln/ext/generator/gem_make.out
How would I go about solving this?
reinstall. from your console, go to the path where you now have the devkit
D:\stuff\devkit
ruby dk.rb init - then open up the config.yml file that lives in that directory... make sure it's pointing to your ruby installation
ruby dk.rb install
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

gem installation with Ruby2 x64

I'm trying to install rails, but before I need to install devkit correctly.
So I'm making the normal procedure but I don't understand what's wrong. I'm using ruby 2 x64, and I tried with the DevKit x32 and x64. this is with the devkit x64. What can be wrong in here..? Thank You.
c:\DevKit>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.
C:/Ruby200-x64/bin/ruby.exe extconf.rb
creating Makefile
make
generating generator-x64-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems
/json-1.8.0/lib/C/Ruby200-x64/lib/ruby/site_ruby/2.0.0/x64-msvcrt/json/ext
/usr/bin/install: cannot create regular file `C:/Ruby200-x64/lib/ruby/gems/2.0.0
/gems/json-1.8.0/lib/C/Ruby200-x64/lib/ruby/site_ruby/2.0.0/x64-msvcrt/json/ext'
: No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-
1.8.0 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.0/ext/json/ex
t/generator/gem_make.out
NOTE: Before I installed with "ruby dk.rb install -f" in both x32 and x64 cases.
EDIT: For who is attempting to reply about the ruby dk.rb etc. procedure, I've done multiple times this:
c:\DevKit>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.
c:\DevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.
C:/Ruby200-x64
c:\DevKit>ruby dk.rb install -f
[WARN] Updating (with backup) existing gem override for 'C:/Ruby200-x64'
[WARN] Updating (with backup) DevKit helper library for 'C:/Ruby200-x64'
I have also windows with installed java,jdk
I tried
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]
C:\Users\rajarshid>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed json-1.8.0
Parsing documentation for json-1.8.0
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/parser.so, skipping
Installing ri documentation for json-1.8.0
Done installing documentation for json (2 sec).
1 gem installed
Please check whether dev kit install properly or not
ruby dk.rb review
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Rails is not creating a new app correctly - conflict with JSON 1.7.7?

I'm trying to learn Ruby on Rails with a online tutorial.
[rails version]: Rails 3.2.13
[ruby version] : ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
When I execute the command:
rails new first_app
I get:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Sure enough, I ran gem install json -v '1.7.7 as listed, however the results are:
[philippe#localhost rails_projects]$ gem install json -v '1.7.7'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
Has anyone seen that?
If you are in a "rpm" system (Fedora or Red Hat) use:
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
It solved the problem for me.

Resources