用Mina安装JRuby宝石

时间:2014-07-24 18:29:13

标签: ruby gem jruby mechanize mina

我正在尝试使用Mina在JRuby上部署应用程序,但是一个gem没有安装,实际上它不应该首先安装...

gem是unf_ext,它是一个Mechanize依赖项。如果我通过SSH连接到服务器并尝试安装Mechanize,则会安装没有问题,因此只安装unf,而不是unf_ext

错误:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

       /home/linkrecover/.rbenv/versions/jruby-1.7.13/bin/jruby extconf.rb  
   NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS. 

      (root) at /home/linkrecover/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/mkmf.rb:8 
     require at org/jruby/RubyKernel.java:1065 
      (root) at /home/linkrecover/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1 
      (root) at extconf.rb:1 


   Gem files will remain installed in /var/www/lr/tmp/build-14062262733806/vendor/bundle/jruby/1.9/gems/unf_ext-0.0.6 for inspection. 
   Results logged to /var/www/lr/tmp/build-14062262733806/vendor/bundle/jruby/1.9/gems/unf_ext-0.0.6/ext/unf_ext/gem_make.out 
   An error occurred while installing unf_ext (0.0.6), and Bundler cannot continue. 
   Make sure that `gem install unf_ext -v '0.0.6'` succeeds before bundling. 

我的Gemfile:https://gist.github.com/davidhq/09d84bc79683b9d3332e

那么如何让捆绑器在通过Mina运行时安装好一切?

2 个答案:

答案 0 :(得分:0)

您声明的一些gems( Gemfile.lock 应该告诉哪一个)取决于使用本机C扩展的unf_ext gem。您将需要以某种方式避免使用JRuby(例如,使用与其他人一样的平台:: mri )的宝石。细节取决于有问题的宝石以及您需要多少宝石,例如如果它仅用于开发,只需将其移至组:开发bundle --without development

答案 1 :(得分:0)

事实证明Gemfile.lock没有JRuby的依赖关系,因为我正在使用MRI进行开发。我在本地切换到JRuby并运行bundle install以在Gemfile.lock中生成正确的信息并提交它...现在一切安装都很好。