我有一个Rails应用程序,我想运行到Docker容器中。

我已经运行了bundle install ..但收到此错误:

Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。

/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150517-474-  15nbph7.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

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
 VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                ^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in     /var/www/test/xyz/vendor/bundle/ruby/2.2.0/gems/json-1.7.7 for inspection.
Results logged to /var/www/test/xyz/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

如何在/ vendor / bundle中安装json gem?

gem install json -v 1.7.7 --path / vendor / bundle

无效,路径参数是不允许的。 ...

===============>>#1 票数:0 已采纳

我遇到了同样的错误。 该错误是由于我们使用的ruby软件(宝石)的版本有时不匹配。

您正在使用2.2.1版的ruby。 您的Gemfile包含旧版本的gems,它取决于json版本1.7.7。

您应该安装以下Ruby版本:

ruby-1.9.3-p448

要消除该错误,或​​者更新与ruby 2.2.1版兼容的宝石即可解决问题。

  ask by Felix translate from so

未解决问题?本站智能推荐: