0

I've seen other questions asked similar (like this one), however it's slightly different.

I created a brand new Rails API app with the command rails new backend -d=postgresql -T --api. I have the database all set up and connecting fine. Now I am trying to install the graphql gem. It's in my Gemfile, I've run bundle install, and the next step is to run the command bundle exec rails generate graphql:install according to the docs. When I run this however, I get this error:

/Users/jimmiejackson/.rvm/gems/ruby-2.5.5/gems/bundler-2.2.11/lib/bundler/rubygems_integration.rb:334:in `block (2 levels) in replace_gem': 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. (LoadError)
    from /Users/jimmiejackson/.rvm/gems/ruby-2.5.5/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `<top (required)>'
    from ...
    from ...

I can't find any answers in the Github issues, Google or Stack. I'm not sure why I'd be getting a sqlite error when I installed with postgresql from new. It's been a little while since I last worked on a Rails app, what could be the issue?

Gemfile:

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

ruby '2.5.5'

gem 'rails', '~> 6.0.3', '>= 6.0.3.5'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 4.1'
gem 'bcrypt', '~> 3.1.7'
gem 'graphql', '1.9.17'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'

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
  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 'graphiql-rails', '1.7.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

database.yml:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: movie_show_tracker_development

test:
  <<: *default
  database: movie_show_tracker_test
J. Jackson
  • 3,326
  • 8
  • 34
  • 74

1 Answers1

0

Well I finally got it worked out. I ended up having to start the project over from scratch again and used Ruby v.2.6.3/ Rails v.6.0.3.5 to get the graphql gem working appropriately. Not even sure those were the main culprits or not, but it appears to be working now!

J. Jackson
  • 3,326
  • 8
  • 34
  • 74