[英]nokogiri gem - ERROR: Failed to build gem native extension.
i'm trying to deploy a rails application with capistrano but i'm having some problems with nokogiri gem when is bundle installing in the server ubuntu 16.04我正在尝试使用 capistrano 部署一个 rails 应用程序,但是当在服务器 ubuntu 16.04 中安装捆绑包时,我在使用 nokogiri gem 时遇到了一些问题
The backtrace is the following:回溯如下:
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as root@104.236.11.204: bundle exit status: 5
bundle stdout: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/var/www/denunciabarranquillafinal/shared/bundle/ruby/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20171113-30499-1nk84ws.rb
extconf.rb --use-system-libraries
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r
./siteconf20171113-30499-1nk84ws.rb extconf.rb --use-system-libraries 2>&1
Gem files will remain installed in
/var/www/denunciabarranquillafinal/shared/bundle/ruby/2.3.0/gems/nokogiri-1.8.1
for inspection.
Results logged to
/var/www/denunciabarranquillafinal/shared/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.1/gem_make.out
An error occurred while installing nokogiri (1.8.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling.
In Gemfile:
rails was resolved to 4.2.4, which depends on
actionmailer was resolved to 4.2.4, which depends on
actionpack was resolved to 4.2.4, which depends on
actionview was resolved to 4.2.4, which depends on
rails-dom-testing was resolved to 1.0.8, which depends on
nokogiri
bundle stderr: Nothing written
I ran the command我运行了命令
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
in my server, and if I run "gem install nokogiri" the gem is installed normally.在我的服务器中,如果我运行“gem install nokogiri”,gem 就会正常安装。
I hope someone can help me to fix the error.我希望有人可以帮助我修复错误。
try this :试试这个 :
$ sudo apt-get update
$ sudo apt-get install libxml2-dev libxslt-dev
$ sudo gem install nokogiri
I know this is years after this thread started, but i had this same problem with nokogiri and capybara.我知道这是在这个线程开始几年后,但我对 nokogiri 和水豚也有同样的问题。 I'm on Ubuntu 20.04, but had the same issue on Ubuntu 18.04 - same computer.
我在 Ubuntu 20.04 上,但在 Ubuntu 18.04 上遇到了同样的问题 - 同一台计算机。
sudo apt-get update
sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
sudo apt-get install libxml2-dev libxslt-dev
sudo gem install nokogiri
sudo gem install capybara
I tried everything I could find, but nothing seemed to work.我尝试了我能找到的一切,但似乎没有任何效果。 I'm not sure what did it, but above are the last commandline commands I tried.
我不确定它做了什么,但上面是我尝试过的最后一个命令行命令。 Poof... It worked finally.
噗……终于成功了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.