我尝试在我的Mac(10.13.3)上安装rails,我运行了这个命令:gem install rails
,但我一直遇到这个错误:
Ignoring bigdecimal-1.3.4 because its extensions are not built. Try: gem pristine bigdecimal --version 1.3.4
Ignoring bigdecimal-1.3.2 because its extensions are not built. Try: gem pristine bigdecimal --version 1.3.2
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring binding_of_caller-0.8.0 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.8.0
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-10.0.0 because its extensions are not built. Try: gem pristine byebug --version 10.0.0
Ignoring byebug-9.1.0 because its extensions are not built. Try: gem pristine byebug --version 9.1.0
Ignoring byebug-9.0.6 because its extensions are not built. Try: gem pristine byebug --version 9.0.6
Ignoring concurrent-ruby-ext-1.0.5 because its extensions are not built. Try: gem pristine concurrent-ruby-ext --version 1.0.5
Ignoring debase-0.2.2 because its extensions are not built. Try: gem pristine debase --version 0.2.2
Ignoring debase-0.2.2.beta11 because its extensions are not built. Try: gem pristine debase --version 0.2.2.beta11
Ignoring debug_inspector-0.0.3 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.3
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
Ignoring ffi-1.9.21 because its extensions are not built. Try: gem pristine ffi --version 1.9.21
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/stevesun/.rvm/gems/ruby-2.4.3/gems/nokogiri-1.8.2/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180224-46538-1jvz3n7.rb extconf.rb
Ignoring bigdecimal-1.3.4 because its extensions are not built. Try: gem pristine bigdecimal --version 1.3.4
Ignoring bigdecimal-1.3.2 because its extensions are not built. Try: gem pristine bigdecimal --version 1.3.2
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring binding_of_caller-0.8.0 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.8.0
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-10.0.0 because its extensions are not built. Try: gem pristine byebug --version 10.0.0
Ignoring byebug-9.1.0 because its extensions are not built. Try: gem pristine byebug --version 9.1.0
Ignoring byebug-9.0.6 because its extensions are not built. Try: gem pristine byebug --version 9.0.6
Ignoring concurrent-ruby-ext-1.0.5 because its extensions are not built. Try: gem pristine concurrent-ruby-ext --version 1.0.5
Ignoring debase-0.2.2 because its extensions are not built. Try: gem pristine debase --version 0.2.2
Ignoring debase-0.2.2.beta11 because its extensions are not built. Try: gem pristine debase --version 0.2.2.beta11
Ignoring debug_inspector-0.0.3 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.3
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
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.3.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.7.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Downloading libxml2-2.9.7.tar.gz (100%)
Extracting libxml2-2.9.7.tar.gz into tmp/x86_64-apple-darwin17/ports/libxml2/2.9.7... OK
Running 'configure' for libxml2 2.9.7... OK
Running 'compile' for libxml2 2.9.7... ERROR, review '/Users/stevesun/.rvm/gems/ruby-2.4.3/gems/nokogiri-1.8.2/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.7/compile.log' to see what happened. Last lines are:
========================================================================
CCLD libxml2.la
CC testdso.lo
CCLD testdso.la
CC xmllint.o
CCLD xmllint
ld: warning: ignoring file /usr/local/Cellar/xz/5.2.3/lib/liblzma.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/Cellar/xz/5.2.3/lib/liblzma.dylib
Undefined symbols for architecture i386:
"_lzma_auto_decoder", referenced from:
_xz_head in libxml2.a(xzlib.o)
"_lzma_code", referenced from:
_xz_decomp in libxml2.a(xzlib.o)
"_lzma_end", referenced from:
___libxml2_xzclose in libxml2.a(xzlib.o)
"_lzma_properties_decode", referenced from:
_is_format_lzma in libxml2.a(xzlib.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [xmllint] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
/Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:402:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in `chdir'
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in `execute'
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:115:in `compile'
from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:154:in `cook'
from extconf.rb:365:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:364:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:551:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/stevesun/.rvm/gems/ruby-2.4.3/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/stevesun/.rvm/gems/ruby-2.4.3/gems/nokogiri-1.8.2 for inspection.
Results logged to /Users/stevesun/.rvm/gems/ruby-2.4.3/extensions/universal-darwin-17/2.3.0/nokogiri-1.8.2/gem_make.out
我尝试过的事情:
我试图和sudo
一起跑,但也没有运气,可能我不应该尝试。
我也打开了错误文件,可以看到完整的详细信息here。 在我看来没有什么明显的东西。
任何想法/指示将不胜感激!
答案 0 :(得分:-1)
尝试安装铁路:
gem install railties