2

我正在使用 react-rails 做一个项目,但是当我运行时

bundle install

我明白了

Could not find json-1.8.1 in any of the sources

具体来说,这是整个错误

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

    current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
/Users/montana/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160629-5602-i1di2t.rb extconf.rb
creating Makefile

current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/montana/.rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/Users/montana/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/intern.h:797:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ (    \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1

在stackoverflow上有很多关于这个的帖子,并且尝试了大多数“解决方案”,但似乎没有一个对我有用,我也跑了

gem list | grep json

它说我有 json gem via

 json (1.8.3)
 multi_json (1.10.1)

我试图停止春天,更新宝石和捆绑器。我也跑过

rbenv rehash

无济于事,仍然收到此错误,任何输入将不胜感激。

4

2 回答 2

3

我上次遇到问题Ubuntu,我尝试安装它library,它也能正常工作。

sudo apt-get install libgmp3-dev

您可以参考文档:Failed to build gem json native extension

于 2016-06-30T02:11:16.920 回答
2

您可能想要降低 ruby​​ 版本或提高 json 版本。见:https ://github.com/flori/json/issues/229

快速浏览了 json 1.8.1 gemspec,到目前为止还没有提到 ruby​​ 2.3.0 支持。

于 2016-06-30T01:45:35.770 回答