这是我得到的错误:
MacBook-Pro:myapp marcamilly$ gem install json -v 1.1.3
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/marcamilly/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/Users/marcamilly/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/x86_64-darwin10.4.0 -I/Users/marcamilly/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/Users/marcamilly/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -Wall -o parser.o -c parser.c
parser.rl:2:16: error: re.h: No such file or directory
In file included from parser.rl:3:
/Users/marcamilly/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward/st.h:2:2: warning: #warning use "ruby/st.h" instead of bare "st.h"
parser.rl: In function ‘cParser_initialize’:
parser.rl:499: error: ‘struct RHash’ has no member named ‘tbl’
parser.rl:511: error: ‘struct RHash’ has no member named ‘tbl’
parser.rl:518: error: ‘struct RHash’ has no member named ‘tbl’
make: *** [parser.o] Error 1
Gem files will remain installed in /Users/marcamilly/.rvm/gems/ruby-1.9.2-p0/gems/json-1.1.3 for inspection.
Results logged to /Users/marcamilly/.rvm/gems/ruby-1.9.2-p0/gems/json-1.1.3/ext/json/ext/parser/gem_make.out
关于如何解决这个问题的任何想法?
我相信我之前可能已经安装了json作为另一个项目(Rails项目)的一部分,但现在我正在尝试安装这个特定的项目,与Sinatra一起使用,这是我得到的错误。
感谢。
答案 0 :(得分:0)
在安装此gem之前,似乎必须选择ruby 1.8.7
作为当前版本的Ruby。
我终于正确安装了它。