Postgres:无法从NodeJS(PG)连接到md5

Windows 10上的Node v6.2; PG(node-postgres)v4.4.2

Ubuntu 14.04上的Postgres 9.5 Trusty VirtualBox

我正在使用PG(node-postgres)模块在虚拟机上连接到Ubuntu上的Postgres。 我能够使用Navicat连接没有问题,但是当我连接NodeJS时,那些相同的凭据不起作用。 postgres日志显示这个:

xxxx@yyyy FATAL: password authentication failed for user "xxxx" xxxx@yyyy DETAIL: Connection matched pg_hba.conf line 96: "host all all all $ 

我添加了这行到我的pg_hba.conf文件,现在它的工作,但任何人都可以解释为什么md5不工作?

 # I added this line: host all all all password # This line was already here: host all all all md5 

Node v6有一个突破性的改变,所以你需要从你所说的v4.4.2升级“pg”(node-postgres)到v6.0.1。

https://github.com/brianc/node-postgres/issues/1000