Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using pg-dump-restore: ENOENT for pg_dump command #14

Open
gzsig opened this issue Mar 4, 2024 · 1 comment
Open

Error using pg-dump-restore: ENOENT for pg_dump command #14

gzsig opened this issue Mar 4, 2024 · 1 comment

Comments

@gzsig
Copy link

gzsig commented Mar 4, 2024

I encountered an error when attempting to use the pg-dump-restore library to dump a PostgreSQL database. The process fails with an ENOENT error for the pg_dump command.

Error Message

{
  'full error :>> ': Error: Command failed with ENOENT: pg_dump --dbname=postgresql://postgres:sudo@localhost:5432/testeprod --format=custom --file=./dump.sql
  spawn pg_dump ENOENT
      at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
      at __node_internal_errnoException (node:internal/errors:623:12)
      at ChildProcess._handle.onexit (node:internal/child_process:283:19)
      at onErrorNT (node:internal/child_process:476:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    errno: -2,
    code: 'ENOENT',
    syscall: 'spawn pg_dump',
    path: 'pg_dump',
    spawnargs: [
      '--dbname=postgresql://postgres:sudo@localhost:5432/testeprod',
      '--format=custom',
      '--file=./dump.sql'
    ],
    originalMessage: 'spawn pg_dump ENOENT',
    shortMessage: 'Command failed with ENOENT: pg_dump --dbname=postgresql://postgres:sudo@localhost:5432/testeprod --format=custom --file=./dump.sql\n' +
      'spawn pg_dump ENOENT',
    command: 'pg_dump --dbname=postgresql://postgres:sudo@localhost:5432/testeprod --format=custom --file=./dump.sql',
    escapedCommand: 'pg_dump "--dbname=postgresql://postgres:sudo@localhost:5432/testeprod" "--format=custom" "--file=./dump.sql"',
    exitCode: undefined,
    signal: undefined,
    signalDescription: undefined,
    stdout: '',
    stderr: '',
    failed: true,
    timedOut: false,
    isCanceled: false,
    killed: false
  }
}
image

Steps to Reproduce

  1. Installed pg-dump-restore via yarn.
  2. Attempted to dump a PostgreSQL database using the provided syntax in the library documentation.
  3. The process failed with the error message above.
image

Expected Behavior

The library should successfully initiate a dump of the specified PostgreSQL database using pg_dump.

Actual Behavior

The command fails with an ENOENT error, indicating that pg_dump could not be found or executed.

Environment

  • Node.js version: v18.17.1
  • Operating System: MacOs Sonoma 14.0
@RazaShehryar
Copy link

You need to install libpq using brew.
brew install libpq

After that, you will need to do this
brew link --force libpq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants