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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails 5

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

Ruby

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

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Q&A

1回答

1802閲覧

nokogiriのインストールでnokogiriをコンパイル出来なく、エラーが出まくる

renren643

総合スコア279

Ruby on Rails 5

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

Ruby

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

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

0グッド

1クリップ

投稿2019/08/04 11:14

編集2019/08/04 11:15

前提・実現したいこと

railsで既存のアプリをcloneして、bundle installを行いたいのですが、nokogiriのインストール(おそらくコンパイル段階)でエラーが発生し、gemをインストール出来ません。

この原因を探り、エラーを取り除きたいです。

仮想環境上でvagrantを立ててやっています。
boxはbento/amazonlinux-2です。

rubyは2.4.1
railsは5.1.6
rubyはインストール済みです。

解決策をご存知の方がいれば 教えていただきたいです。

発生している問題・エラーメッセージ

$ bundle install --path vendor/bundle

をすると、

Fetching nokogiri 1.8.4 Installing nokogiri 1.8.4 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ext/nokogiri /home/vagrant/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20190804-23564-1r2lh07.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using packaged libraries. Using mini_portile version 2.3.0 checking for gzdopen() in -lz... yes checking for iconv... yes ************************************************************************ IMPORTANT NOTICE: Building Nokogiri with a packaged version of libxml2-2.9.8 with the following patches applied: - 0001-Revert-Do-not-URI-escape-in-server-side-includes.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.8.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.8... OK Running git apply with /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK Running 'configure' for libxml2 2.9.8... OK Running 'compile' for libxml2 2.9.8... OK Running 'install' for libxml2 2.9.8... OK Activating libxml2 2.9.8 (from /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ports/x86_64-pc-linux-gnu/libxml2/2.9.8)... ************************************************************************ IMPORTANT NOTICE: Building Nokogiri with a packaged version of libxslt-1.1.32. 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 ************************************************************************ Extracting libxslt-1.1.32.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxslt/1.1.32... OK Running 'configure' for libxslt 1.1.32... OK Running 'compile' for libxslt 1.1.32... OK Running 'install' for libxslt 1.1.32... OK Activating libxslt 1.1.32 (from /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ports/x86_64-pc-linux-gnu/libxslt/1.1.32)... checking for -llzma... yes checking for xmlParseDoc() in libxml/parser.h... yes checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes checking for exsltFuncRegister() in libexslt/exslt.h... yes checking for xmlHasFeature()... yes checking for xmlFirstElementChild()... yes checking for xmlRelaxNGSetParserStructuredErrors()... yes checking for xmlRelaxNGSetParserStructuredErrors()... yes checking for xmlRelaxNGSetValidStructuredErrors()... yes checking for xmlSchemaSetValidStructuredErrors()... yes checking for xmlSchemaSetParserStructuredErrors()... yes creating Makefile current directory: /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ext/nokogiri make "DESTDIR=" clean current directory: /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ext/nokogiri make "DESTDIR=" compiling html_document.c compiling html_element_description.c compiling html_entity_lookup.c compiling html_sax_parser_context.c compiling html_sax_push_parser.c compiling nokogiri.c compiling xml_attr.c compiling xml_attribute_decl.c compiling xml_cdata.c compiling xml_comment.c compiling xml_document.c compiling xml_document_fragment.c compiling xml_dtd.c compiling xml_element_content.c compiling xml_element_decl.c compiling xml_encoding_handler.c compiling xml_entity_decl.c compiling xml_entity_reference.c compiling xml_io.c compiling xml_libxml2_hacks.c compiling xml_namespace.c compiling xml_node.c compiling xml_node_set.c compiling xml_processing_instruction.c compiling xml_reader.c compiling xml_relax_ng.c compiling xml_sax_parser.c compiling xml_sax_parser_context.c compiling xml_sax_push_parser.c compiling xml_schema.c compiling xml_syntax_error.c compiling xml_text.c compiling xml_xpath_context.c compiling xslt_stylesheet.c linking shared-object nokogiri/nokogiri.so Cleaning files only used during build. rm -rf /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports rm -rf /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ports current directory: /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4/ext/nokogiri make "DESTDIR=" install /usr/bin/install -c -m 0755 nokogiri.so ./.gem.20190804-23564-1x4wqub/nokogiri /usr/bin/install: `./.gem.20190804-23564-1x4wqub/nokogiri/nokogiri.so' のパーミッションを設定します: Operation not permitted make: *** [install-so] エラー 1 make install failed, exit code 2 Gem files will remain installed in /var/www/cryptospells/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.8.4 for inspection. Results logged to /var/www/cryptospells/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.8.4/gem_make.out An error occurred while installing nokogiri (1.8.4), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.8.4' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails_admin was resolved to 1.4.2, which depends on rails was resolved to 5.1.6, which depends on actioncable was resolved to 5.1.6, which depends on actionpack was resolved to 5.1.6, which depends on actionview was resolved to 5.1.6, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri

該当のソースコード

Gemfile

1 2source 'https://rubygems.org' 3 4git_source(:github) do |repo_name| 5 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 6 "https://github.com/#{repo_name}.git" 7end 8 9gem 'devise', '4.5.0' 10gem 'rails_admin' 11gem 'omniauth', '1.6.1' 12gem 'omniauth-twitter', '1.4.0' 13gem 'dotenv-rails', '2.2.1' 14gem 'therubyracer', platforms: :ruby 15gem 'paypal-sdk-rest' 16gem 'whenever' 17gem 'feedjira' 18gem 'httpclient' 19gem 'kaminari' 20gem 'redis' 21gem 'rack-user_agent' 22 23gem 'aws-sdk-rails' 24gem 'aws-record' 25 26gem 'webpacker', github: 'rails/webpacker' 27gem 'activerecord-import', '0.27.0' 28gem 'carrierwave' 29gem 'fog' 30gem 'rmagick' 31gem 'enum_help' 32gem 'sentry-raven' 33 34 35gem 'rails', '~> 5.1.6' 36gem 'puma', '~> 3.7' 37gem 'sass-rails', '~> 5.0' 38gem 'uglifier', '>= 1.3.0' 39gem 'coffee-rails', '~> 4.2' 40gem 'jbuilder', '~> 2.5' 41

試したこと

yumで色々なものをインストールしてみました。

下記は、sudo yum install でインストールしたものです。

- openssl-devel - readline-devel - zlib-devel - gcc - gcc-c++ - ImageMagick - ImageMagick-devel - libxml2-devel - libcurl - libcurl-devel - libxslt-devel - libxslt

また、エラーメッセージに書かれていた

sample.rb

1 2gem install nokogiri -- --use-system-libraries 3bundle config build.nokogiri --use-system-libraries 4bundle install 5gem install nokogiri -v '1.8.4'などもやりましたがダメでした。 6 7また、最初に、 8gem install bundler 9gem install rails 10 11も行なっています。 12

補足情報(FW/ツールのバージョンなど)

仮想環境上のvagrantでやっています。
boxはbento/amazonlinux-2です。

rubyは2.4.1
railsは5.1.6
rubyはインストール済みです。

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

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

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

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

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

otn

2019/08/04 13:37

gem install nokogiri -v 1.8.4 のエラーメッセージを載せて下さい。
renren643

2019/08/05 01:33

説明不足でした。 gem install nokogiri -v 1.8.4はインストール出来ました。
guest

回答1

0

/usr/bin/install: `./.gem.20190804-23564-1x4wqub/nokogiri/nokogiri.so' のパーミッションを設定します: Operation not permitted

というところが気になります。
sudo でおこなうとどうなりますか?

投稿2019/08/04 11:54

winterboum

総合スコア23333

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

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

renren643

2019/08/05 01:35

sudo bundle install --path vendor/bundle を行うと、 sudo:bundle not foundが出てきます。
renren643

2019/08/05 01:35

sudo は使えるのですが、sudo:bundle だとnot foundになってしまいます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問