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

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

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

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

Q&A

1回答

741閲覧

rails bundleインストールできない

sumio

総合スコア13

Ruby on Rails 5

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

0グッド

0クリップ

投稿2019/08/05 12:03

前提・実現したいこと

rails の bundleをインストールしたい

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

下記のエラーがでインストールができない。
gemfile.lockのファイルが生成されない

該当のソースコード

An error occurred while installing nokogiri (1.10.3), and Bundler cannot
continue.
Make sure that gem install nokogiri -v '1.10.3' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile:
rails was resolved to 5.2.3, which depends on
actioncable was resolved to 5.2.3, which depends on
actionpack was resolved to 5.2.3, which depends on
actionview was resolved to 5.2.3, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri

試したこと

gemfile に gem "nokogiri" を追記したが
現象は変わらない

補足情報(FW/ツールのバージョンなど)source 'https://rubygems.org'

下記がgemfile です

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.3'

Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

gem 'rails', '~> 5.2.3'

Use sqlite3 as the database for Active Record

gem 'sqlite3'

Use Puma as the app server

gem 'puma', '~> 3.11'

Use SCSS for stylesheets

gem 'sass-rails', '~> 5.0'

Use Uglifier as compressor for JavaScript assets

gem 'uglifier', '>= 1.3.0'

See https://github.com/rails/execjs#readme for more supported runtimes

gem 'duktape'

Use CoffeeScript for .coffee assets and views

gem 'coffee-rails', '~> 4.2'

Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks

gem 'turbolinks', '~> 5'

Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

gem 'jbuilder', '~> 2.5'

Use Redis adapter to run Action Cable in production

gem 'redis', '~> 4.0'

Use ActiveModel has_secure_password

gem 'bcrypt', '~> 3.1.7'

Use ActiveStorage variant

gem 'mini_magick', '~> 4.8'

Use Capistrano for deployment

gem 'capistrano-rails', group: :development

Reduces boot times through caching; required in config/boot.rb

gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do

Call 'byebug' anywhere in the code to stop execution and get a debugger console

gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do

Access an interactive console on exception pages or by calling 'console' anywhere in the code.

gem 'web-console', '>= 3.3.0'
end

group :test do

Adds support for Capybara system testing and selenium driver

gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'

Easy installation and use of chromedriver to run system tests with Chrome

gem 'chromedriver-helper'
end

Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem 'tzinfo-data'#, platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "nokogiri" , "1.10.3"

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

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

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

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

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

8zca

2019/08/06 12:34

こんばんは。 出力された結果の全文を貼ってもらえるとエラーの原因がつかみやすくなります。 また、gemファイルは「コードの挿入」機能を使ってもらえると読みやすくなるのでうれしいです。
sumio

2019/08/06 13:17

ご回答ありがとうございます。 ネットで色々調べて、かいますが一向に糸口が見えず、かれこれ2週間ほどハマっています。何卒よろしくお願いします。 下記が全文です。 c:\test-app>bundle install Fetching gem metadata from https://rubygems.org/............. Fetching gem metadata from https://rubygems.org/. Resolving dependencies.... Using rake 12.3.3 Using concurrent-ruby 1.1.5 Using i18n 1.6.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.2.3 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Fetching nokogiri 1.10.3 Installing nokogiri 1.10.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: c:/test-app/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.3/ext/nokogiri C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/site_ruby/2.6.0 -r ./siteconf20190806-6524-18g9dye.rb extconf.rb --use-system-libraries checking if the C compiler accepts ... yes Building nokogiri using system libraries. pkg-config could not be used to find libxml-2.0 Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1" pkg-config could not be used to find libxslt Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1" pkg-config could not be used to find libexslt Please install either `pkg-config` or the pkg-config gem per gem install pkg-config -v "~> 1.1" ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed. *** 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=C:/Ruby26-x64/bin/$(RUBY_BASE_NAME) --help --clean --use-system-libraries --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --with-xml2-dir --without-xml2-dir --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-libxml-2.0-config --without-libxml-2.0-config --with-pkg-config --without-pkg-config --with-xslt-dir --without-xslt-dir --with-xslt-include --without-xslt-include=${xslt-dir}/include --with-xslt-lib --without-xslt-lib=${xslt-dir}/lib --with-libxslt-config --without-libxslt-config --with-exslt-dir --without-exslt-dir --with-exslt-include --without-exslt-include=${exslt-dir}/include --with-exslt-lib --without-exslt-lib=${exslt-dir}/lib --with-libexslt-config --without-libexslt-config To see why this extension failed to compile, please check the mkmf.log which can be found here: c:/test-app/vendor/bundle/ruby/2.6.0/extensions/x64-mingw32/2.6.0/nokogiri-1.10.3/mkmf.log extconf failed, exit code 1 Gem files will remain installed in c:/test-app/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.3 for inspection. Results logged to c:/test-app/vendor/bundle/ruby/2.6.0/extensions/x64-mingw32/2.6.0/nokogiri-1.10.3/gem_make.out An error occurred while installing nokogiri (1.10.3), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.3' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.3, which depends on actioncable was resolved to 5.2.3, which depends on actionpack was resolved to 5.2.3, which depends on actionview was resolved to 5.2.3, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri
guest

回答1

0

こんばんは。
この手のエラーは、ちゃんとエラーを読むと解決の糸口がつかめます。
貼っていただいているエラーメッセージに

ERROR: cannot discover where libxml2 is located on your system

と出ていますので、libxml2を入れてあげればbundle installできると思います。

OSのバージョンによって手順は変わるかもしれませんが、Windowsで同様の手順を踏まれた方のQiita記事があったので参考までに貼っておきますね。
https://qiita.com/tanakahisateru/items/76d7049b806dfa2e59f9

投稿2019/08/06 13:36

8zca

総合スコア559

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

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

sumio

2019/08/07 13:02

ご回答ありがとうございます。 お教えいただいたサイトの手順通りに進めているのですが、またつまずいています。msys.batを開いてコマンド入力してもエラーが出てしまいます。 対処方法をお教え願います ーーーーーーー下記がーーーーーーーーーー smio@LAPTOP-JTI84MF7 ~ $ cd libxml2 sh: cd: libxml2: No such file or directory sumio@LAPTOP-JTI84MF7 ~ $ ーーーーーーーーーーーーーーーー ーーーーーー下記が手順ーーーーーーーーー DevKitの msys.bat を叩いてもうひとつシェルを開きます。 $ cd libxml2 $ cd libxml2-2.9.1 $ ./configure $ make $ make install $ cd .. $ cd libxslt-1.1.28 $ ./configure
8zca

2019/08/07 16:17

cd: libxml2: No such file or directory は libxml2 のフォルダが無いという意味です。 1つ上の手順で mkdir libxml2 を実行することで libxml2フォルダを作っていると思いますが、 そこに移動するということを指しています。
sumio

2019/08/08 15:12

度々すみません DevKitの msys.bat を叩いてもうひとつシェルを開いて実行したのですが 今度は  $ ./configure  のところでエラーがでてしまいました。 どうすればよいでしょうか? ーーーーコマンドーーーーーーーー sumio@LAPTOP-JTI84MF7 ~ $ cd libxml2 sumio@LAPTOP-JTI84MF7 ~/libxml2 $ cd libxml2-2.9.1 sumio@LAPTOP-JTI84MF7 ~/libxml2/libxml2-2.9.1 $ ./configure sh: ./configure: No such file or directory sumio@LAPTOP-JTI84MF7 ~/libxml2/libxml2-2.9.1 $
8zca

2019/08/08 15:48

/libxml2/libxml2-2.9.1 にいる状態で ls -la を打った結果を教えてください。 ちなみに以下のコマンドは実行済ですよね? これをやることで libxml2-2.9.1 フォルダが作られ、その中に configure ファイルが存在しているはずです。 --- コマンド -- $ curl -O ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz $ tar xzf libxml2-2.9.1.tar.gz
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問