简体   繁体   English

无法在ruby 2.3.1上安装rails gem

[英]Cannot install rails gem on ruby 2.3.1

I am trying to install rails on ruby 2.3.1. 我正在尝试在ruby 2.3.1上安装滑轨。

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Ruby installed. Ruby已安装。

$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

RVM exists. RVM存在。

$ 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/rvm/gems/ruby-2.3.1/gems/nokogiri-1.7.0.1/ext/nokogiri
/usr/local/rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170227-6774-1l4uc6c.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170227-6774-1l4uc6c.rb extconf.rb 2>&1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.1/gems/nokogiri-1.7.0.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/nokogiri-1.7.0.1/gem_make.out

When I call gem list, I don't see nokogari nor rails. 当我呼叫宝石清单时,我看不到nokogari或rails。 $ gem list $宝石清单

 *** LOCAL GEMS ***
...
minitest (5.8.3)
net-telnet (0.1.1)
pg (0.19.0)
power_assert (0.2.6)
psych (2.0.17)
rack (2.0.1)
rack-test (0.6.3)
raindrops (0.17.0)
rake (10.4.2)
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.1.5)
...

I donot know what is wrong. 我不知道怎么了。

follow instruction here (ignore the japanes, just use the code! http://qiita.com/riocampos/items/43b55ba06e6c3ec01b82 请按照此处的说明操作(忽略日本,只需使用代码即可! http: //qiita.com/riocampos/items/43b55ba06e6c3ec01b82

$ brew update

$ brew install libxml2

$ brew link --force libxml2

$ gem install nokogiri -- --use-system-libraries

in case of problems use sudo: 如果出现问题,请使用sudo:

sudo gem install nokogiri -- --use-system-libraries libxml2

guess System 10.2.3 uses incompatible libxml2, so forced linking to the «outdated» libxml2 installed with homebrew does the job. 猜测系统10.2.3使用了不兼容的libxml2,因此强制链接到随自制软件安装的“过时” libxml2即可。

The same work around with libxml2 is also needed for sqlite3 byebug ie sqlite3 byebug也需要与libxml2进行相同的工作,即

$ sudo gem install byebug -- --use-system-libraries libxml2

that means: when ever you meet the error-information: couldn't understand kern.osversion `16.4.0' cc1: error: unrecognized command line option "-Wdivision-by-zero" 这意味着:每当您遇到错误信息时:无法理解kern.osversion`16.4.0'cc1:错误:无法识别的命令行选项“ -Wdivision-by-zero”

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

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