Rails
でアプリを作成したので、AWS
にデプロイしようと考えています。
https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1
を参考にして進めていたのですがDBを作成する所でLoadError:
になってしまいました。
いろいろ調べてsqlite3
のバージョンを指定してbundle install
したりしてみたのですが解決しませんでした。
わかる方いましたらぜひ知恵を貸していただけると幸いです。
よろしくお願いしますm(__)m
#エラー
$ rake db:create RAILS_ENV=production rake aborted! LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile. /var/www/rails/Life-changing/app/models/application_record.rb:1:in `<main>' /var/www/rails/Life-changing/app/models/user.rb:1:in `<main>' /var/www/rails/Life-changing/config/routes.rb:8:in `block in <main>' /var/www/rails/Life-changing/config/routes.rb:1:in `<main>' /var/www/rails/Life-changing/config/environment.rb:5:in `<main>' Caused by: Gem::LoadError: sqlite3 is not part of the bundle. Add it to your Gemfile. /var/www/rails/Life-changing/app/models/application_record.rb:1:in `<main>' /var/www/rails/Life-changing/app/models/user.rb:1:in `<main>' /var/www/rails/Life-changing/config/routes.rb:8:in `block in <main>' /var/www/rails/Life-changing/config/routes.rb:1:in `<main>' /var/www/rails/Life-changing/config/environment.rb:5:in `<main>' Tasks: TOP => db:create => db:load_config => environment (See full trace by running task with --trace)
database.yml
# SQLite. Versions 3.8.0 and up are supported. # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default database: Life-changing_production username: root password:
Gemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3' # Use Puma as the app server gem 'puma', '~> 4.1' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 4.0' # 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.7' gem 'devise' gem 'bootstrap', '~> 4.1.1' gem 'jquery-rails' gem 'font-awesome-rails' gem "refile", require: "refile/rails", github: 'manfe/refile' gem "refile-mini_magick" gem 'mini_racer' gem 'faker' gem 'devise-i18n' gem 'devise-i18n-views' gem 'rails-i18n' gem "chartkick" gem 'kaminari' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant # gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false group :development, :test do #gem 'sqlite3', '1.4.1' gem 'sqlite3', '~> 1.3.6' #修正した箇所 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'rspec-rails' gem "factory_bot_rails" gem 'pry-rails' 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' gem 'listen', '~> 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' gem 'better_errors' gem 'binding_of_caller' gem "rails-erd" gem 'pry-rails' 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 web drivers to run system tests with browsers gem 'webdrivers' end group :production do gem 'pg', '1.1.4' end group :production, :staging do gem 'unicorn' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#環境
Amazon Linux2
ruby 2.6.3p62
Rails 6.0.3.4
sqlite3 3.7.17
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。