Json Gem上的Rails Bundle安装失败:失败

时间:2016-01-09 05:41:59

标签: ruby json ruby-on-rails-4

尝试进行捆绑安装甚至gem安装json -v'1.8.1'时出现以下错误

Installing json 1.8.1 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
/home/noname/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160109-4872-1jxs5yc.rb extconf.rb
creating Makefile

current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
 VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                           ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [enabled by default]
 VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                ^
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/json-1.8.1 for inspection.
Results logged to /home/noname/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/json-1.8.1/gem_make.out

Ruby版本:2.3.0和Rails版本:4.0.3

我按照建议here尝试了解决方案,但这也没有用。 如果有人知道这个问题或者过去已经解决了这个问题,请帮助我。

2 个答案:

答案 0 :(得分:1)

如果链接中的上述解决方案没有为您锻炼,请尝试安装这两个

"<spring:url value="/product/${product.id}" />"

让我知道这是否有效

答案 1 :(得分:0)

尝试完所有后,我的解决方案就是下一个命令:

rvm get head
rvm –force install 2.3.0 # put your version of ruby
rvm use 2.3.0 # the same version as above
gem install bundle
gem install rails