質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

2回答

1561閲覧

Railsでnokogiriのインストールができなくて困っています。

Laugh

総合スコア11

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2019/11/07 07:55

編集2019/11/07 08:19

### native extension を利用する gem のインストールに失敗する

Railsでアプリ開発をしようともい、Railsのインストールを試みる。すると下記のようなエラーコードが出てきました。自分なりに呼んだのですがどうも**nokogiri**のインストールでつまずいている模様。解決の可能性だけでも浮かんだ方がいましたら返答お願いしたいです。

ドットインストールでずっと勉強していたため、環境はWin10上にVagrantCentOSを載せています。

エラーコード

ERROR: Error installing rails: ERROR: Failed to build gem native extension.

エラー全文

[vagrant@localhost ~]$ gem install rails -v 5.1.3 --no-document Fetching actionpack-5.1.3.gem Fetching rack-test-0.6.3.gem Fetching actionview-5.1.3.gem Fetching activesupport-5.1.3.gem Fetching i18n-0.9.5.gem Fetching actioncable-5.1.3.gem Fetching rails-5.1.3.gem Fetching railties-5.1.3.gem Fetching activejob-5.1.3.gem Fetching actionmailer-5.1.3.gem Fetching arel-8.0.0.gem Fetching activemodel-5.1.3.gem Fetching activerecord-5.1.3.gem Fetching websocket-driver-0.6.5.gem Successfully installed i18n-0.9.5 Successfully installed activesupport-5.1.3 Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension. current directory: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5/ext/nokogiri /home/vagrant/.rbenv/versions/2.6.5/bin/ruby -I /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20191006-28714-1175yzn.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. Using mini_portile version 2.4.0 checking for gzdopen() in -lz... yes checking for iconv... yes ************************************************************************ IMPORTANT NOTICE: Building Nokogiri with a packaged version of libxml2-2.9.10 with the following patches applied: - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch - 0002-Remove-script-macro-support.patch - 0003-Update-entities-to-remove-handling-of-ssi.patch 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. ************************************************************************ Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10... OK Running git apply with /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK Running git apply with /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5/patches/libxml2/0002-Remove-script-macro-support.patch... OK Running git apply with /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK Running 'configure' for libxml2 2.9.10... ERROR, review '/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10/configure.log' to see what happened. Last lines are: ======================================================================== configure: WARNING: you should use --build, --host, --target checking whether to enable maintainer-specific portions of Makefiles... yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... configure: error: newly created file is older than distributed files! Check your system clock ======================================================================== *** 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 --without-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=/home/vagrant/.rbenv/versions/2.6.5/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 /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:402:in `block in execute': Failed to complete configure task (RuntimeError) from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in `chdir' from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in `execute' from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:110:in `configure' from /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:153: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:557:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/nokogiri-1.10.5/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.5 for inspection. Results logged to /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/nokogiri-1.10.5/gem_make.out

試したこと

Rubyの再インストール、
gemのアップデート
gccのアップデート

### エラーの解読
エラーコードに書いてある、

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

は一通り試しました。

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

では↓を実行しなさいと言われたので

gem install pkg-config -v "~> 1.1"

を実行、このGemのインストールはできたものの、再度nokogiriのインストールをしても初期のエラーと変わらず...
最後の bundle install はそもそもGemFileが存在しないため実行できませんでした。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kazto

2019/11/07 08:02

/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/nokogiri-1.10.5/mkmf.log の内容を追記お願いします。
Laugh

2019/11/07 08:05

‘‘‘ "gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */ "gcc -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror -c conftest.c" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main() {return 0;} /* end */ have_library: checking for gzdopen() in -lz... -------------------- yes "gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lz -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <zlib.h> 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return 0; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))gzdopen; return !p; } /* end */ -------------------- have_iconv?: checking for iconv... -------------------- yes "gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <stdlib.h> 4: #include <iconv.h> 5: 6: int main(void) 7: { 8: iconv_t cd = iconv_open("", ""); 9: iconv(cd, NULL, NULL, NULL, NULL); 10: return EXIT_SUCCESS; 11: } /* end */ ‘‘‘
kazto

2019/11/07 08:15

上記ですべてでしょうか?エラーが見当たりません。
Laugh

2019/11/07 08:20

全てです...
Laugh

2019/11/07 08:28

"gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */ "gcc -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror -c conftest.c" checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main() {return 0;} /* end */ have_library: checking for gzdopen() in -lz... -------------------- yes "gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lz -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <zlib.h> 4: 5: /*top*/ 6: extern int t(void); 7: int main(int argc, char **argv) 8: { 9: if (argc > 1000000) { 10: int (* volatile tp)(void)=(int (*)(void))&t; 11: printf("%d", (*tp)()); 12: } 13: 14: return 0; 15: } 16: int t(void) { void ((*volatile p)()); p = (void ((*)()))gzdopen; return !p; } /* end */ -------------------- have_iconv?: checking for iconv... -------------------- yes "gcc -o conftest -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/x86_64-linux -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/backward -I/home/vagrant/.rbenv/versions/2.6.5/include/ruby-2.6.0 -I. -I/home/vagrant/.rbenv/versions/2.6.5/include -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wmissing-noreturn -Winline conftest.c -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L. -L/home/vagrant/.rbenv/versions/2.6.5/lib -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/vagrant/.rbenv/versions/2.6.5/lib -L/home/vagrant/.rbenv/versions/2.6.5/lib -lruby-static -lpthread -lrt -lrt -lrt -ldl -lcrypt -lm -lm -lc " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <stdlib.h> 4: #include <iconv.h> 5: 6: int main(void) 7: { 8: iconv_t cd = iconv_open("", ""); 9: iconv(cd, NULL, NULL, NULL, NULL); 10: return EXIT_SUCCESS; 11: } /* end */ -------------------- cyberduck を更新し忘れていたかもしれないので更新して再度追記いたします。
guest

回答2

0

ベストアンサー

エラー内容は見ないで回答しますが、だいたいCentOSのgem install時にハマるパターンは決まっているので、こちらをお試しください。

CentOSにおけるgem install時のエラーの解決の流れ

  • (1) 必要とされているdevelパッケージをyumコマンドでインストールする
  • (2) gem installを試す
  • (3) エラーが出たら、(1)(2)を繰り返す

(1) nokogiriが必要とするパッケージをインストールする

※CentOSではnative extension系のエラーはdevelパッケージをインストールとだいたい解決します。
どのdevelパッケージが必要なのかはエラーメッセージなどから判断したり、
「CentOS nokogiri devel」とかで検索すると分かる場合があります。

nokogoriの場合は「libxml2-devel」「libxslt-devel」のはずです。

$ sudo yum install -y libxml2-devel libxslt-devel

(2) gem installを試す

$ gem install rails -v 5.1.3 --no-document

投稿2019/11/07 08:22

mingos

総合スコア4025

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Laugh

2019/11/07 08:34

libxml2-devel,libxslt-devel はインストールできましたが変わらず同じエラーメッセージが出てきました...
mingos

2019/11/07 08:36

なるほど、ではまた別の問題ということですね。 ちなみにCentOS7ですか?
Laugh

2019/11/07 08:40

今解決いたしました! develパッケージをインストールした後、 $ gem install nokogiri -- --use-system-libraries でnokogiriだけインストールした後にRailsをインストールしたら何の引っ掛かりもなくできました! ありがとうございます!
mingos

2019/11/07 08:41

解決したようで安心しました!
guest

0

エラーメッセージに、

checking whether build environment is sane... configure: error: newly created file is older than distributed files!

Check your system clock

とあります。時計がずれているとSSL通信の障害となるなど何かとトラブルになりますので、仮想マシン内の時計が正しいかも確認してみてください。

投稿2019/11/07 08:42

maisumakun

総合スコア145183

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問