Postgres libpq dependencies failing on deploy

Quite likely this is an issue with libpq as mentioned in

Downgrading the node version Netlify build is using may (or may not) solve this.

Have you tried switching to another library as mentioned in the thread you linked to?