In case of the error uninitialized constant GraphiQL when using the graphql gem, here is a suggested fix.

Background

This can occur after installing the library, as running rails generate graphql:install adds graphiql-rails to the project’s Gemfile. At this point running serve or a similar Rails task may cause the following error to appear in console output:

/config/routes.rb:3:in `block in <main>': uninitialized constant GraphiQL (NameError)

Solution

Since the graphql gem has added a new gem to the Gemfile, Bundler should be run again to install it:

bundle install

Running the same Rails task again should now succeed.