无法在任何来源中找到json-1.8.1

时间:2016-06-30 00:25:10

标签: ruby-on-rails ruby react-rails

我正在使用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

无济于事,仍然会收到此错误,任何输入都会受到高度赞赏。

2 个答案:

答案 0 :(得分:3)

我上次在Ubuntu遇到了问题,我尝试安装此library并且也能正常运行。

sudo apt-get install libgmp3-dev

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

答案 1 :(得分:1)

您可能希望降低ruby版本或颠覆json版本。请参阅:https://github.com/flori/json/issues/229

快速浏览一下json 1.8.1 gemspec并且至今没有提及ruby 2.3.0支持。