Error about nokogiri while capistrano deployment on ubuntu server

后端 未结 4 1081
一个人的身影
一个人的身影 2021-02-02 01:10

While bundle:install phase after deploy:finalize_update,i\'m getting an error about nokogiri. It suggests ,

 ** [out :: *******] Make s         


        
相关标签:
4条回答
  • 2021-02-02 01:41

    If you're using Capistrano 3.x you can do the following in your deploy.rb file (or environment specific file i.e. deploy/production.rb)

    set :bundle_env_variables, { 'NOKOGIRI_USE_SYSTEM_LIBRARIES' => 1 }
    

    This way you avoid overriding the bundle install task. This will set the given env variables when running bundle install.

    0 讨论(0)
  • 2021-02-02 01:45

    Connect to you host with deployer user, than try install bundle by yourself:

    cd {your last release path}
    bundle config build.nokogiri --with-xml2-include=/usr/include/libxml2/libxml
    bundle install --gemfile Gemfile --path shared/bundle --deployment --quiet --without development test
    

    Than run capistrano manually.

    This worked for me.

    0 讨论(0)
  • 2021-02-02 01:51

    Based on @zekus answer, I created a new task in capistrano like this:

      task :custom_bundle_install, roles: :app do
        run "cd /home/#{user}/apps/#{application}/releases/#{release_name} && NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install --gemfile /home/#{user}/apps/#{application}/releases/#{release_name}/Gemfile --path /home/#{user}/apps/#{application}/shared/bundle --deployment --quiet --without development test"
      end
      before "bundle:install", "deploy:custom_bundle_install"
    

    This worked for me pretty well.

    0 讨论(0)
  • 2021-02-02 01:52

    I faced the same issue with Nokogiri 1.6.0. The problem, as you can see from the logs, it's caused by a failed compilation of libxml2 that, together with libxslt, is now shipped embedded in the gem and compiled when you install it.

    To find out what exactly went wrong with the compilation, have a look at the suggested file compile.log that, in your case, you can find at:

    /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.6.0/ext/nokogiri/tmp/x86_64-linux-gnu/ports/libxml2/2.8.0/compile.log
    

    As a workaround (assuming you have libxml2-dev and libxslt-dev installed), you can do:

    NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install
    

    I hope it helps.

    0 讨论(0)
提交回复
热议问题