我有一个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
如果不允许,那么路径参数就不能用了。 ......答案 0 :(得分:0)
我得到了同样的错误。这个错误是因为我们使用的ruby软件(gems)版本在某些时候并不匹配。
您正在使用ruby版本2.2.1。你的Gemfile包含旧版本的宝石,它取决于json版本1.7.7。
您应该安装以下ruby版本:
ruby-1.9.3-p448
摆脱错误,或者更新与ruby版本2.2.1兼容的宝石就可以了。