每次尝试更新或安装JSON gem时,都会出现构建错误。这些是输出文件中的结果:
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
我开始学习Rails,我想在继续学习之前解决这个问题。
这是生成的默认Gemfile:
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
答案 0 :(得分:1)
要构建需要本机构建工具的Gems,请确保已安装DevKit。链接中提供了说明。
您可以添加gem install json
或适当命令的结果吗?
答案 1 :(得分:0)
如果这只是本地的,你可以随时采用简单的方法来代替gem install json_pure
(100%的Ruby实现,它很慢但是有效)
答案 2 :(得分:0)
这是一个老问题,但这对我有用:https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#gems_fails_comspec_autorun
特别是情景B
REG QUERY "HKCU\Software\Microsoft\Command Processor" /s
如果你得到一个' AUTORUN'响应,删除如下:
REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun