2015-02-01 19 views
6

Tôi đang cố gắng cài đặt Rails 4.2.0 trên máy tính của mình, nhưng tôi đang gặp sự cố khi cài đặt Nokogiri. Tôi làm theo các bước trong câu trả lời đầu tiên cho "bundle install stopped at Nokogiri", nhưng khi tôi chạy brew install nokogiri, tôi nhận được như sau:Sự cố khi cài đặt Nokogiri trên Mac OS X Yosemite v.10.10.1 vì libxml2 trong khi nâng cấp lên Rails 4.2.0

Activating libxslt 1.1.28 (from /Users/dseibert/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)... 
checking for main() in -llzma... yes 
checking for xmlParseDoc() in libxml/parser.h... no 
checking for xmlParseDoc() in -lxml2... no 
checking for xmlParseDoc() in -llibxml2... no 
----- 
libxml2 is missing. Please locate mkmf.log to investigate how it is failing. 
----- 
*** 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. 

Provided configuration options: 
    --with-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/Users/dseibert/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME) 
    --help 
    --clean 
    --use-system-libraries 
    --enable-static 
    --disable-static 
    --with-zlib-dir 
    --without-zlib-dir 
    --with-zlib-include 
    --without-zlib-include=${zlib-dir}/include 
    --with-zlib-lib 
    --without-zlib-lib=${zlib-dir}/lib 
    --enable-cross-build 
    --disable-cross-build 
    --with-xml2lib 
    --without-xml2lib 
    --with-libxml2lib 
    --without-libxml2lib 

extconf failed, exit code 1 

Gem files will remain installed in /Users/dseibert/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection. 
Results logged to /Users/dseibert/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.6.2/gem_make.out 

tôi không thể tìm thấy các tập tin MKMF để xác định vị trí các chi tiết của tập tin libxml2 của tôi, và tôi don' t xem tệp libxml2 hoặc thư mục Nokogiri trong thư mục nguồn Ruby của tôi.

Và khi tôi chạy brew install libxml2, tôi nhận được Warning: libxml2-2.9.2 already installed.


Theo nhận xét, tôi nhận được phản hồi: Successfully installed nokogiri-1.6.6.2. Nhưng khi tôi chạy sudo gem install rails, tôi đã nhận lại lỗi ở trên.

+0

http://stackoverflow.com/questions/19643153/error-to-install-nokogiri-on-osx-10-9-maverick –

+0

Chào mừng bạn đến với Stack Overflow. Không cần phải nói "Cập nhật ..." hoặc "Chỉnh sửa ..." hoặc những thứ tương tự. Chúng tôi có thể thấy các thay đổi đối với câu hỏi của bạn khi chúng tôi có đủ điểm. Cũng không cần thiết phải cảm ơn chúng tôi, và nó hơi chán nản. Stack Overflow có mục tiêu là một nguồn tài nguyên giống như Wikipedia cho các câu hỏi lập trình. Như vậy, câu hỏi là tài liệu tham khảo. Bạn đã từng thấy ai nói lời cảm ơn hay yêu cầu trợ giúp trong một bách khoa toàn thư? Chỉ cần đặt câu hỏi hay, đừng lo lắng về việc có một cuộc trò chuyện, và bạn sẽ làm tốt. –

+0

Bạn đã giải quyết vấn đề này? Chia sẻ ở đây tại sao tôi cũng gặp lỗi này. :/ –

Trả lời

4

Hãy thử điều này

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2/ 

này hoạt động trên OSX 10.11 EI Capitan

+0

Đồng thời kiểm tra: http://stackoverflow.com/questions/24251494/nokogiri-gem-installation-error/34609741#34609741 –

1

Hãy thử điều này:

bundle config build.nokogiri --use-system-libraries 
bundle install 

này hoạt động trên đường ray 4.2.0, OS X 10.11.2 El Capitan và Xcode 7.2.1 được cài đặt Bạn sẽ nhận được khi chạy gói:

Installing nokogiri 1.6.7.2 with native extensions 
Các vấn đề liên quan