error: error: password authentication failed for user "electron_release_server_user"

error: error: password authentication failed for user "electron_release_server_user"

我正在研究这个令人惊叹的 Sails 项目 here

我设法让它在我的 Macbook Pro 上 100% 正常运行,几乎没有任何困难。

Here's my fork.

现在我试图让它在 Azure Ubuntu 14.04 盒子上工作,在 运行 之后用 npm start 调用 node app.js 我得到这个错误:

Error creating a connection to Postgresql using the following settings:
{ host: 'localhost',
 port: 5432,
 schema: true,
 ssl: false,
 adapter: 'sails-postgresql',
 user: 'electron_release_server_user',
 password: '[redacted]',
 database: 'electron_release_server',
 identity: 'postgresql' }

* * *
Complete error details:
 { error: password authentication failed for user "electron_release_server_user"
    at Connection.parseE (/home/azureuser/electron-release-server/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/home/azureuser/electron-release-server/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/home/azureuser/electron-release-server/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:535:20)
 name: 'error',
 length: 117,
 severity: 'FATAL',
 code: '28P01',
 detail: undefined,
 hint: undefined,
 position: undefined,
 internalPosition: undefined,
 internalQuery: undefined,
 where: undefined,
 schema: undefined,
 table: undefined,
 column: undefined,
 dataType: undefined,
 constraint: undefined,
 file: 'auth.c',
 line: '285',
 routine: 'auth_failed' }

在我的 local.js 我有:

connections: {
    postgresql: {
      adapter: 'sails-postgresql',
      host: 'localhost',
      user: 'electron_release_server_user',
      password: '<SECRET>',
      database: 'electron_release_server'
    }
  },

这个确切的配置在我的本地机器上工作,但现在它在这个 Ubuntu VM 上......运气不好。

有人吗?我需要这个才能发布产品!

根据我的经验,该问题属于Client Authentication问题的范围,您可以参考Postgres文档了解,请参阅http://www.postgresql.org/docs/9.1/static/client-authentication-problems.html

通常的解决方法是通过Postgres命令ALTER USER查看或修改指定用户的密码,请看文档http://www.postgresql.org/docs/9.1/static/sql-alteruser.html.

有一个现有的SO线程可以参考,请参阅Postgresql: password authentication failed for user "postgres"

希望对您有所帮助。

原来是我的Node版本

Node.js 6.0 似乎无法正常工作。一旦我降级到 LTS,噗,一切都按预期工作。