Circle CI fails to execute psql command when running rake db:structure:load

So this is my config.yml

version: 2.1

orbs:
  queue: eddiewebb/queue@1.5.0

executors:
  node_postgres_redis:
    docker:
      - image: circleci/ruby:2.4.10-node-browsers
        environment:
          CC_TEST_REPORTER_ID: 7ceff1524bdc09dsd3e232321cf9daa531154170d590823232eddqw2330f3570
          PGHOST: 127.0.0.1
          RAILS_ENV: test
          TEST_REPORT_PATH: "test/reports"
      - image: circleci/postgres:9.6.2-alpine
        environment:
          POSTGRES_USER: circleci
          POSTGRES_DB: circleci-jet-test
          POSTGRES_PASSWORD: ""
      - image: circleci/redis:3.2
  ubuntu:
    machine:
      image: ubuntu-1604:202004-01

commands:
  setup_and_run_test:
    steps:
      - checkout

      # Restore bundle cache
      - restore_cache:
          key: jet-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}

      # imagemagic
      - run:
          name: Setup Image Magick
          command: |
            sudo apt-get install libmagickwand-dev imagemagick imagemagick-6.q16 libmagickcore-dev
            sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/Magick-config /usr/bin/Magick-config
  
      - run:
          name: Install Bundler
          command: |
            gem install bundler -v 1.17.3

      # Install gem dependencies
      - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle

      # Store bundle cache
      - save_cache:
          key: jet-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle

      # Database setup
      - run:
          name: Database Setup
          command: |
            bundle exec rake db:create
            bundle exec rake db:migrate
            bundle exec rake db:structure:load

Everythings runs properly until it tries to execute

bundle exec rake db:structure:load

Then it throws this error which is a bit weird

failed to execute:

psql -q -f /home/circleci/circleci-jet/db/structure.sql *****_test

Please check the output above for any errors and make sure that psql is installed in your PATH and has proper permissions.

I cannot understand this error and what needs to be done on my side.

Anyone with examples, please can show me direction.

Thanks

Looks like you need to install the psql client into the executor. I assume you’re using a debian/ubuntu based executor so add this command to the relevant run: block:

sudo apt install postgresql-client

Also I found this post that seems related