尽管有许多烫发和用户迭代

时间:2018-04-23 23:19:40

标签: node.js postgresql sequelize.js

Linux Pop!分配(第17版Ubuntu) 定制台式机

我已经工作了很长时间,试图让一个简单的sequelize db:migrate命令工作。

我安装了postgresql,如果我su - postgres然后psql我可以进入psql commannd提示符(也可以使用\q离开)。

我正在开发一个需要使用sequelize-cli管理器的项目。我安装了npm i --save sequelize@4.32.6 pg@7.4.1 pg-hstore@2.3.2

然后我在我的目录中执行了sequelize init,并调整了数据库文件。

const path = require("path");

module.exports = {
  "config": path.resolve("./db/config", "config.json"),
  "models-path": path.resolve("./db/models"),
  "seeders-path": path.resolve("./db/seeds"),
  "migrations-path": path.resolve("./db/migrations")
};

这是sequelize的config.json文件:

{
  "development": {
    "username": "postgres",
    "password": null,
    "database": "address-bloc-dev",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "logging": false
  },
  "test": {
    "username": "postgres",
    "password": null,
    "database": "address-bloc-test",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "logging": false
  }
}

无论我做什么,每当我尝试sequelize db:migrate时,我都会这样做:

$ sequelize db:migrate

Sequelize CLI [Node: 6.11.4, CLI: 4.0.0, ORM: 4.32.6]

Loaded configuration file "db/config/config.json".
Using environment "development".
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:237:13

ERROR: password authentication failed for user "postgres"

无论我是以主要普通用户身份登录还是以postgres身份登录,都会收到此错误消息。我可以在两者之间su,导航到正确的目录,但仍然得到相同的结果。

我之前还收到了另一个错误postgres is not in the sudoers file. This incident will be reported.

根据有关stackoverflow的建议,我尝试将postgres用户添加到sudo usermod -a -G sudo postgres并将postgres设为正式帐户。它显示在我的登录屏幕上。

这确实导致第二个sudoers...错误消失。

但是,我仍然最终得到相同的password authentication failure...错误。

我也尝试以常规用户和sudo命令安装npm。

我已经尝试进入pg_hba.config文件并根据stackoverflow的另一个建议将peer更改为ident。没有运气,仍然。

关于为什么我不能让sequelize-cli执行此操作的任何想法?

编辑:我收到了一些回复,但到目前为止我还没弄清楚我做错了什么。在评论中做了一些笔记。谢谢。

0 个答案:

没有答案