困っていること
Ruby on Railsの既存アプリをcloneしてきて、Macbook Airのローカル環境でVScodeを使って開発を進めようとしているのですが、rails db
,rails s
などをのrailsコマンドを叩くとbundle install
が成功しているのにも関わらず、
Could not find nokogiri-1.8.5 in any of the sources Run `bundle install` to install missing gems.
というエラーが出てしまい、この先に進めません。
Gemの読み込みpathとかが関係あるのかな?と思って色々pathとか,gemのインストール先を変えて試しているのですが、うまくいきません。助けてください。
rbenvとかがちょっとよくわからない時にrbenvの設定をしたのでpathの設定のしかたなど間違えてるかもしれませんが。。。
試したこと
% gem env RubyGems Environment: - RUBYGEMS VERSION: 3.0.3 - RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [x86_64-darwin19] - INSTALLATION DIRECTORY: /Users/y.nakata/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0 - USER INSTALLATION DIRECTORY: /Users/y.nakata/.gem/ruby/2.6.0 - RUBY EXECUTABLE: /Users/y.nakata/.rbenv/versions/2.6.3/bin/ruby - GIT EXECUTABLE: /usr/bin/git - EXECUTABLE DIRECTORY: /Users/y.nakata/.rbenv/versions/2.6.3/bin - SPEC CACHE DIRECTORY: /Users/y.nakata/.gem/specs - SYSTEM CONFIGURATION DIRECTORY: /Users/y.nakata/.rbenv/versions/2.6.3/etc - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-19 - GEM PATHS: - /Users/y.nakata/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0 - /Users/y.nakata/Desktop/PJS/pj_name/vendor/bundle/gems - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - https://rubygems.org/ - SHELL PATH: - /Users/y.nakata/.rbenv/versions/2.6.3/bin - /Users/y.nakata/.rbenv/libexec - /Users/y.nakata/.rbenv/plugins/ruby-build/bin - /usr/local/opt/openssl@1.1/bin - /usr/local/opt/mysql@5.7/bin - /usr/local/opt/libiconv/bin - /usr/local/opt/libxslt/bin - /usr/local/opt/libiconv/bin - /Users/y.nakata/.rbenv/shims - /Users/y.nakata/.rbenv/bin - /usr/local/Cellar/pyenv-virtualenv/1.1.5/shims - /Users/y.nakata/.pyenv/shims - /Users/y.nakata/.pyenv/bin - /Users/y.nakata/google-cloud-sdk/bin - /Users/y.nakata/.pyenv/shims - /Users/y.nakata/.pyenv/bin - /usr/local/bin - /usr/bin - /bin - /usr/sbin - /sbin - /Library/Apple/usr/bin - /usr/local/opt/openssl@1.1/bin - /usr/local/opt/mysql@5.7/bin - /usr/local/opt/libiconv/bin - /usr/local/opt/libxslt/bin - /Users/y.nakata/.rbenv/shims - /Users/y.nakata/.rbenv/bin - /usr/local/Cellar/pyenv-virtualenv/1.1.5/shims - /Users/y.nakata/.pyenv/shims - /Users/y.nakata/.pyenv/bin - /Users/y.nakata/google-cloud-sdk/bin - /Users/y.nakata/opt/anaconda3/bin - /Users/y.nakata/opt/anaconda3/condabin - /Users/y.nakata/flutter/bin
bundle install:
% bundle install --path /Users/y.nakata/Desktop/PJS/pj_name/vendor/bundle/gems (省略) Using swagger_ui_engine 1.1.2 Using thinreports 0.10.3 Using timecop 0.9.1 Using timeliness 0.3.8 Using uglifier 4.1.20 Using validates_timeliness 4.0.2 Using wareki 0.4.1 Using whenever 0.10.0 Using whiny_validation 1.0 Bundle complete! 96 Gemfile dependencies, 428 gems now installed. Bundled gems are installed into `./vendor/bundle/gems`
環境
Ruby: 2.6.3
Rails: 5.2.0
IDE: VScode
PC: Macbook Air
DB: localhost MySQL
Ruby:
% ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
rbenv:
% rbenv version 2.6.3 (set by /Users/y.nakata/Desktop/PJS/pj_name/.ruby-version)
% rbenv versions system 2.6.0 * 2.6.3 (set by /Users/y.nakata/Desktop/PJS/pj_name/.ruby-version)
rails:
% rails -v Could not find nokogiri-1.8.5 in any of the sources Run `bundle install` to install missing gems.
発生している問題・エラーメッセージ
base) user % rails db Could not find nokogiri-1.8.5 in any of the sources Run `bundle install` to install missing gems.
該当のソースコード
Gemfile
Gemfile
1source 'https://rubygems.org' 2 3# gem 'rails', github: 'rails/rails' 4gem 'rails', '~> 5.2.0' 5gem 'bootsnap' 6gem 'puma' 7 8gem 'browserify-rails' 9gem 'coffee-rails', '~> 4.2' 10gem 'sass-rails' 11gem 'uglifier', '>= 1.3.0' 12 13gem 'mysql2' 14gem 'ruby-mysql' 15 16group :development, :test do 17 gem 'byebug', platform: :mri 18 gem 'faker' # for seeds 19 gem 'gimei' # for seeds 20 gem 'letter_opener_web' 21 gem 'rails-controller-testing' 22 gem 'rubocop' 23 gem 'slim_lint' 24 gem 'timecop' 25 26 gem 'guard' 27 gem 'guard-minitest' 28 gem 'guard-rubocop' 29 gem 'minitest-ar-assertions', require: 'minitest_activerecord_assertions' 30 gem 'minitest-power_assert' 31 gem 'minitest-stub_any_instance' 32end 33 34group :development do 35 # debug 36 gem 'better_errors' 37 gem 'binding_of_caller' 38 gem 'bullet' 39 gem 'i18n-debug' 40 gem 'listen', '>= 3.0.5' 41 gem 'rack-mini-profiler', require: false 42 gem 'spring' 43 gem 'spring-watcher-listen', '~> 2.0.0' 44 45 # commands 46 gem 'brakeman' 47 gem 'bundler-audit' 48 gem 'html2slim' 49 gem 'i18n_generators' 50 gem 'license_finder' 51 gem 'rails_best_practices' 52 gem 'rubycritic' # static codes analytics 53 54 # engines 55 gem 'rails_admin' # data viewer and 56 gem 'rails_admin-i18n' 57 gem 'swagger_ui_engine' # API viewr 58end 59 60# 本番リリーズの際には、developmentのみ読み込むように設定を直す 61gem 'rails_db' # DB viewer and Sql executor 62gem 'whiny_validation' # Validation Errorをログ出力 63# ここまで 64 65# engines 66gem 'action_policy' 67gem 'devise' 68gem 'devise-encryptable' 69 70gem 'activerecord-session_store' 71 72# api 73gem 'faraday' 74gem 'faraday_middleware' 75gem 'grape' 76gem 'grape-entity' # format json 77gem 'grape-swagger' 78gem 'grape-swagger-entity' 79 80# model 81gem 'activerecord-import' # data import 82gem 'activerecord-userstamp', path: './vendor/gem-local' 83gem 'acts_as_list' 84gem 'by_star' # 日付分析関連の便利scope群 85gem 'carrierwave' # 画像 86gem 'draper' 87gem 'enum_help' 88gem 'fog-aws' # For Carrierwave(S3用) 89gem 'paper_trail' 90gem 'paranoia', '~> 2.2' 91gem 'validates_timeliness' # 日付のValidation 92gem 'wareki' # 和暦を西暦に変更 93# gem 'composite_primary_keys' 94 95# view 96gem 'cells' 97gem 'cells-rails' 98gem 'cells-slim' 99gem 'cocoon' 100gem 'kaminari' 101gem 'ransack' 102gem 'redcarpet' 103gem 'simple_form' 104gem 'slim' 105gem 'slim-rails' 106gem 'rails_autolink' 107 108# UI 109#gem 'bootstrap-sass', '>= 3.3.7' 110gem 'font-awesome-rails' 111 112# configuration 113gem 'config' 114gem 'dotenv-rails' 115gem 'seed_dump' 116gem 'seedbank' 117 118# util 119gem 'business_time' 120gem 'geoip' 121gem 'hashie' 122 123# controller 124gem 'responders' # configure default flashes and 'respond_to' 125 126# cron 127gem 'whenever', require: false 128 129# AWS 130gem 'aws-sdk-rails' 131 132# db 133gem 'ridgepole', '>= 0.7.2' 134# gem 'activerecord-mysql-awesome' # TODO: gem compatibility 135 136# pdf 137gem 'aws-sdk' 138gem 'thinreports' 139 140# lon_lat 141gem 'mechanize' 142gem 'nokogiri', '1.8.5' 143 144# monitering 145gem 'sentry-raven' 146gem 'stackprof' 147gem "memory_profiler" 148gem "derailed_benchmarks" 149
(installed) gem list
% gem list *** LOCAL GEMS *** bigdecimal (default: 1.4.1) bundler (2.1.4, default: 1.17.2) cmath (default: 1.0.0) csv (default: 3.0.9) date (default: 2.0.0) dbm (default: 1.0.0) did_you_mean (1.3.0) e2mmap (default: 0.1.0) etc (default: 1.0.1) fcntl (default: 1.0.0) fiddle (default: 1.0.0) fileutils (default: 1.1.0) forwardable (default: 1.2.0) gdbm (default: 2.0.0) io-console (default: 0.4.7) ipaddr (default: 1.2.2) irb (default: 1.0.0) json (default: 2.1.0) logger (default: 1.3.0) matrix (default: 0.1.0) mini_portile2 (2.4.0) minitest (5.11.3) mutex_m (default: 0.1.0) mysql2 (0.5.2) net-telnet (0.2.0) nokogiri (1.10.10) openssl (default: 2.1.2) ostruct (default: 0.1.0) power_assert (1.1.3) prime (default: 0.1.0) psych (default: 3.1.0) rake (12.3.2) rdoc (default: 6.1.0) rexml (default: 3.1.9) rss (default: 0.2.7) scanf (default: 1.0.0) sdbm (default: 1.0.0) shell (default: 0.7) stringio (default: 0.0.2) strscan (default: 1.0.0) sync (default: 0.5.0) test-unit (3.2.9) thwait (default: 0.1.0) tracer (default: 0.1.0) webrick (default: 1.4.2) xmlrpc (0.3.0) zlib (default: 1.0.0)
追記
taich730さんからのコメントでnokogiriのバージョンが違うとのご指摘がありましたので、一度gem uninstall nokogiri
を行ってからgem install nokogiri -v 1.8.5
で$ gem list
内に下記のように1.8.5のnokogiriが追加されましたが、それでもrails db
ときにCould not find nokogiri-1.8.5 in any of the sources
のエラーが出ます。
調べたところ$LOAD_PATHがrailsコマンドを実行した時のgemを見に行くpathのようなのですが、変更の仕方、本当にここなのかがわかりません。。
minitest (5.11.3) mutex_m (default: 0.1.0) mysql2 (0.5.2) net-telnet (0.2.0) nokogiri (1.8.5) openssl (default: 2.1.2) ostruct (default: 0.1.0)
回答2件
あなたの回答
tips
プレビュー