简体   繁体   English

Rails安装失败-是由Nokogiri gem造成的吗?

[英]Rails install fails - cause by Nokogiri gem?

I am trying to setup a ruby on rails environment on my mac in order to start using the RubyMine IDE. 我试图在Mac上的Rails环境中设置一个ruby,以便开始使用RubyMine IDE。 I have used homebrew, rbenv and all other required libraries in order to install ruby/rails - however when I sudo gem install rails the install fails due to : 我已经使用homebrew,rbenv和所有其他必需的库来安装ruby / rails-但是,当我对sudo gem install rails进行安装时,由于以下原因导致安装失败:

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161110-767-xwnfls.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

I have tried to install Nokogiri on it's own and I get the following error: 我尝试自行安装Nokogiri,但出现以下错误:

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8.1/.autotest

I really hope somebody can help me as I am quite a noob to RonR and I feel like things have gotten messy directory/permission wise, 我真的希望有人能为我提供帮助,因为我对RonR相当陌生,而且我觉得目录/权限方面的工作变得凌乱,

Thank you. 谢谢。

Let's take a quick look at a small part of the error that you have provided us. 让我们快速看一下您提供给我们的错误的一小部分。

zlib is missing; necessary for building libxml2

It's trying to tell you that you do not have zlib , so let's get it. 它试图告诉您您没有zlib ,所以让我们开始吧。 Since you said you're using a Mac, I would install a package manager like Homebrew . 既然您说您使用的是Mac,我将安装Homebrew之类的软件包管理器。 Try doing brew install zlib to install this package. 尝试执行brew install zlib来安装此软件包。

Additionally, if you're starting out learning Ruby, regardless of what platform you are using, it might be helpful to use something like rbenv or rvm to manage different versions of Ruby and the gems that go along with those versions. 另外,如果您开始学习Ruby,无论使用什么平台,都可以使用rbenvrvm之类的东西来管理Ruby的不同版本以及与这些版本一起使用的gem。 You will run into less permissions issues (eg having to run gem install as a privileged user), some of which may be easy to solve, but some of which may send you down a rabbit hole for a few hours. 您将遇到较少的权限问题(例如,必须以特权用户身份运行gem install ),其中一些问题可能很容易解决,但其中一些问题可能会使您陷入gem install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM