Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 错误:安装oj时出错:_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails 错误:安装oj时出错:

Ruby on rails 错误:安装oj时出错:,ruby-on-rails,ruby,Ruby On Rails,Ruby,我刚刚第一次从GitHub克隆了一个存储库 我在本地机器上检查了它,因此在mac上的本地存储库中,我运行了以下命令 bin/rails服务器 我得到了以下错误: 在任何源中都找不到activesupport-5.0.0.1 运行bundle install安装缺少的gems 因此,我按照建议运行bundle安装命令,但随后它给了我以下错误 安装oj(2.12.14)时出错,捆绑程序无法继续。 在绑定之前,请确保gem安装oj-v'2.12.14'成功 所以我建议运行:gem安装oj-v'2.12

我刚刚第一次从GitHub克隆了一个存储库

我在本地机器上检查了它,因此在mac上的本地存储库中,我运行了以下命令

bin/rails服务器

我得到了以下错误:

在任何源中都找不到activesupport-5.0.0.1 运行
bundle install
安装缺少的gems

因此,我按照建议运行bundle安装命令,但随后它给了我以下错误

安装oj(2.12.14)时出错,捆绑程序无法继续。 在绑定之前,请确保
gem安装oj-v'2.12.14'
成功

所以我建议运行:gem安装oj-v'2.12.14'

然后我收到了一条很长的警告和错误消息(见下文)。有什么想法吗

ERROR:  Error installing oj:
ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

/usr/local/opt/ruby/bin/ruby -r ./siteconf20170218-3717-1p2bvl9.rb extconf.rb

>>>>> Creating Makefile for ruby version 2.4.0 on x86_64-darwin16 <<<<<

creating Makefile



current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

make "DESTDIR=" clean



current directory: /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj

make "DESTDIR="

compiling cache8.c

compiling circarray.c

compiling compat.c

compiling dump.c

dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]

        cnt = RSTRING_LEN(rstr);

            ~ ^~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_LEN'

     RSTRING_EMBED_LEN(str) : \

     ^~~~~~~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:972:6: note: expanded from macro 'RSTRING_EMBED_LEN'

     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \

     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

dump.c:503:8: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]

        cnt = RSTRING_LEN(rstr);

            ~ ^~~~~~~~~~~~~~~~~

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:977:28: note: expanded from macro 'RSTRING_LEN'

     RSTRING(str)->as.heap.len)

     ~~~~~~~~~~~~~~~~~~~~~~^~~

dump.c:1776:39: warning: 'rb_struct_ptr' is deprecated [-Wdeprecated-declarations]

        for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_PTR(obj); 0 < i; i--, vp++) {

                                             ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1190:33: note: expanded from macro 'RSTRUCT_PTR'

#define RSTRUCT_PTR(st)         rb_struct_ptr(st)

                                ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/intern.h:889:25: note: 'rb_struct_ptr' has been explicitly marked deprecated here

DEPRECATED(const VALUE *rb_struct_ptr(VALUE s));

                        ^

dump.c:1776:37: warning: assigning to 'VALUE *' (aka 'unsigned long *') from 'const VALUE *' (aka 'const unsigned long *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

        for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_PTR(obj); 0 < i; i--, vp++) {

                                           ^ ~~~~~~~~~~~~~~~~

4 warnings generated.

compiling err.c

compiling fast.c

fast.c:816:17: warning: 'rb_data_object_alloc' is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]

    doc->self = rb_data_object_alloc(clas, doc, 0, free_doc_cb);

                ^

/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1379:1: note: 'rb_data_object_alloc' has been explicitly marked deprecated here

rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)

^

fast.c:1280:24: error: use of undeclared identifier 'rb_cFixnum'

        case T_FIXNUM:  type = rb_cFixnum;      break;

                               ^

1 warning and 1 error generated.

make: *** [fast.o] Error 1



make failed, exit code 2



Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14 for inspection.

Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/oj-2.12.14/gem_make.out
错误:安装oj时出错:
错误:无法生成gem本机扩展。
当前目录:/usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14/ext/oj
/usr/local/opt/ruby/bin/ruby-r./siteconf20170218-3717-1p2bvl9.rb extconf.rb
>>>>>在x86_64-darwin16上为ruby 2.4.0版创建Makefile(如.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
dump.c:1776:39:警告:“rb_struct_ptr”已弃用[-Wdeprecated声明]
对于(i=(int)RSTRUCT_LEN(obj),vp=RSTRUCT_PTR(obj);0self=rb\u data\u object\u alloc(clas,doc,0,free\u doc\u cb);
^
/usr/local/ceral/ruby/2.4.0/include/ruby-2.4.0/ruby/ruby.h:1379:1:注意:“rb\u data\u object\u alloc”已在此处明确标记为不推荐
rb_data_object_alloc(值klass、void*data、RUBY_data_FUNC dmark、RUBY_data_FUNC dfree)
^
fast.c:1280:24:错误:使用未声明的标识符'rb_cFixnum'
案例T_FIXNUM:type=rb_cFixnum;break;
^
生成1个警告和1个错误。
make:**[fast.o]错误1
make失败,退出代码2
Gem文件仍将安装在/usr/local/lib/ruby/gems/2.4.0/gems/oj-2.12.14中以供检查。
结果记录到/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/oj-2.12.14/gem_make.out

Fixnum在ruby 2.4中不再是一个东西。要么降级您的ruby,要么将oj更新到支持ruby 2.4的2.16.1。

我尝试将oj升级到2.16.1,但它成功了。然而,当我尝试捆绑安装时,它再次给我同样的错误,告诉我在捆绑之前确保
gem install oj-v'2.12.14'
成功。因此,next的想法是按照你的建议降级Ruby,但是我怎么做仅仅是为了这个存储库?我想我遇到的问题是我已经成功地安装了Ruby,但是我克隆了一个存储库,可能它的代码依赖于一个旧版本的Ruby或者另一个版本的oj。我假设我应该使用RVM以某种方式设置e此存储库的Ruby版本?@KramerKeller在运行
bundle install
之前,您需要在Gemfile.lock中运行
bundle update oj
将oj更新到最新版本。也就是说,使用rvm或其他管理器管理您的Ruby安装始终是一个好主意。大多数管理器都会确定要使用哪个版本的Ruby通过在目录中查找.ruby版本文件使用。如果您克隆的存储库已经有了一个,我不会感到惊讶。我完全删除了RVM。我还删除了我的存储库。我启动了一个新文件,克隆了存储库,并使rbenv正常工作。我可以看到我在本地运行2.3.1,但仍然收到相同的错误。它显示“安装oj(2.12.14)时出错,Bundler无法继续。”Bundle update oj给出了相同的错误。Gem安装似乎引用了ruby 2.4…那么如何让gems for 2.3.1与克隆的repo一起使用呢?我还检查了我的Gem文件,它显示“oj”、“~>2.12.14”和Gemfile.lock显示oj(2.12.14)。我正在尝试学习ruby…但无法让它在我的机器上运行。我遵循了这些说明,第一次至少遇到了一个不同的错误。我使用了ruby 2.3.1。现在它正在做与以前相同的事情,但出现了以下错误-安装pg(0.18.4)时出错,并且绑定程序无法继续。请确保在绑定之前
gem安装pg-v'0.18.4'
成功。