4

安装Redmine。我试过了,

bundle install --without development test postgresql sqlite

,但错误。

Gem::Ext::BuildError: 错误: 无法构建 gem 原生扩展。

current directory:
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/usr/local/bin/ruby -r ./siteconf20161228-21055-1dxe9y9.rb extconf.rb
creating Makefile

current directory:
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory:
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861: error: ‘rb_cFixnum’ undeclared (first use in this
function)
generator.c:861: error: (Each undeclared identifier is reported only
once
generator.c:861: error: for each function it appears in.)
generator.c:863: error: ‘rb_cBignum’ undeclared (first use in this
function)
At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign"
cc1: warning: unrecognized command line option
"-Wno-constant-logical-operand"
cc1: warning: unrecognized command line option
"-Wno-parentheses-equality"
cc1: warning: unrecognized command line option
"-Wno-tautological-compare"
make: *** [generator.o] error 1

make failed, exit code 2

Gem files will remain installed in
/usr/local/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out

An error occurred while installing json (1.8.3), and Bundler
cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before
bundling.

所以,我试过gem install json -v '1.8.3了,但我无法解决它。

你介意读一下这个问题吗?

4

4 回答 4

4

Ruby 2.4 是非常新的。事实上,它仅在 3 天前发布。

由于 Ruby 2.4 中有几个重要的内部更改,很可能许多 gem(以及 Redmine 本身)尚不兼容此版本的 Ruby。

从您的错误消息来看,似乎确实需要调整 JSON gem 以处理 Ruby 2.4 中有关整数的一些更改。

您现在应该使用旧版本的 Ruby,例如 Ruby 2.3.3。正如您在http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Ruby-interpreter上看到的,Redmine 需要特定的 Ruby 版本,具体取决于 Redmine 的版本。

于 2016-12-28T18:48:47.520 回答
0

我现在有同样的问题。要解决它,请安装最新版本bundlerrmagick手动使用gem install更新所有其他软件包gem updatebundle update. 这解决了json 1.8.3和的依赖问题ruby 2.4

但是我在后面遇到了更多问题。它ruby 2.4似乎对数字的解释做了一些改变,这意味着它不再兼容rail 4.x见这篇文章)。更新rails及其依赖似乎还不可能,因为 redmine 需要protected_attributes依赖 activemodel (< 5.0, >= 4.0.1)rails 5.x依赖 activemodel 5.x.

如果更新破坏了向后兼容性,尤其是对于编程语言,那总是很糟糕:(

于 2017-01-27T12:08:59.270 回答
-1

似乎 json gem 有一个新的 ruby​​ 版本(2.4+)的错误, makandracards 的答案是提出了一个简单易行的解决方案。

答案是关于更新 json gem 的版本以解决错误并成功安装 gem。因此,它使用 --conservative 选项更新 json gem。

bundle update json --conservative

于 2019-09-16T14:55:12.827 回答
-2

首轮

gem install bundler

它安装较新的捆绑器并解决本机扩展依赖项

然后运行

bundle install 

它应该可以解决您的问题

于 2016-12-28T11:50:51.083 回答