Skip to content

Unable to connect to postgres #374

@chris72205

Description

@chris72205

Unless I add the pg gem to my Gemfile, I am unable to connect to postgres due to the following error during setup:

...

Checking that the database is available
Error checking database: LoadError: cannot load such file -- pg
  <internal:/[...]/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  <internal:/[...]/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  /[...]/bundle/ruby/3.2.0/gems/sequel-5.73.0/lib/sequel/adapters/postgres.rb:6:in `<top (required)>'
  <internal:/[...]/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  <internal:/[...]/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
  /[...]/bundle/ruby/3.2.0/gems/sequel-5.73.0/lib/sequel/database/connecting.rb:87:in `load_adapter'
  /[...]/bundle/ruby/3.2.0/gems/sequel-5.73.0/lib/sequel/database/connecting.rb:17:in `adapter_class'
  /[...]/bundle/ruby/3.2.0/gems/sequel-5.73.0/lib/sequel/database/connecting.rb:36:in `connect'
  /[...]/bundle/ruby/3.2.0/gems/sequel-5.73.0/lib/sequel/core.rb:124:in `connect'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/env.rb:146:in `db'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli/setup.rb:139:in `block in check_database'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli/setup.rb:188:in `with_new_config'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli/setup.rb:195:in `try'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli/setup.rb:139:in `check_database'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli/setup.rb:32:in `run'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli.rb:74:in `setup'
  /[...]/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
  /[...]/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
  /[...]/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
  /[...]/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/lib/gemstash/cli.rb:34:in `start'
  /[...]/bundle/ruby/3.2.0/gems/gemstash-2.6.0/exe/gemstash:6:in `<top (required)>'
  /[...]/bundle/ruby/3.2.0/bin/gemstash:25:in `load'
  /[...]/bundle/ruby/3.2.0/bin/gemstash:25:in `<top (required)>'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
  /[...]/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
  /[...]/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
  /[...]/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'
The database is not available

I didn't see this mentioned as needed anywhere so I was wondering if it is and I've overlooked it or if it's a bug.

When developing directly from this repo, it fails unless I include the pg gem in the Gemfile. If this is a bug, I'm happy to submit a PR with the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions