JSON Gem will not install (Windows)

你离开我真会死。 提交于 2019-12-22 13:06:06

问题


Every time I try updating or installing the JSON gem I get a build error. These are the results in the output file:

c:/Ruby193/bin/ruby.exe extconf.rb 
creating Makefile

make
generating parser-i386-mingw32.def
compiling parser.c
In file included from c:/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1360,
                 from c:/Ruby193/include/ruby-1.9.1/ruby.h:32,
                 from ../fbuffer/fbuffer.h:6,
                 from parser.rl:1:
c:/Ruby193/include/ruby-1.9.1/ruby/missing.h:41: error: redefinition of 'struct timespec'
c:/Ruby193/include/ruby-1.9.1/ruby/missing.h:48: error: redefinition of 'struct timezone'
make: *** [parser.o] Error 1

I'm starting learning Rails and I wanted to figure this out before I continue.


Here's the default Gemfile that was generated:

source 'http://rubygems.org'

gem 'rails', '3.1.3'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', '~> 0.8.3', :require => false
end

回答1:


For building Gems that require native build tools make sure you have the DevKit installed. Instructions are provided in the link.

Could you add the results of the gem install json or appropriate command please?




回答2:


If this is just locally, you can always take the easy way out and gem install json_pure instead (a 100% Ruby implementation, it's slow but it works)




回答3:


This is an old question, but this worked for me: https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#gems_fails_comspec_autorun

Specifically Scenario B

REG QUERY "HKCU\Software\Microsoft\Command Processor" /s

if you get a 'AUTORUN' response, remove it as follows:

REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun


来源:https://stackoverflow.com/questions/8840804/json-gem-will-not-install-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!