0

使用 pgAdmin4 在 Windows 10 机器上运行我的 Express 项目。

sequelize/config.json带有postgres dialect的文件中,Sequelize 给出了一些错误。

"development": {
    "username": "root",
    "password": null,
    "database": "database_development",
    "host": "127.0.0.1",
    "port": "5432",
    "dialect": "postgres"
  }

但是使用sqlite dialect,它工作正常。

"development": {
    "dialect": "sqlite",
    "storage": "./db.development.sqlite"
    }

gulp watch使用 postgres 方言运行,出现以下错误:

$ gulp watch
[22:00:43] Using gulpfile ~\friendly-stuff\gulpfile.js
[22:00:43] Starting 'build'...
[22:00:43] Starting 'clean'...
[22:00:43] Finished 'clean' after 28 ms
[22:00:43] Starting 'stylus'...
[22:00:43] Finished 'stylus' after 101 ms
[22:00:43] Finished 'build' after 132 ms
[22:00:43] Starting 'server:start'...
[22:00:43] Finished 'server:start' after 10 ms
[22:00:43] Starting 'watch'...
[22:00:43] Finished 'watch' after 20 ms
[22:00:44] Development server listening. (PID:12632)
Mon, 19 Sep 2016 02:00:44 GMT friendly-stuff:server Listening on port 3000
Unhandled rejection SequelizeConnectionRefusedError: 
connect ECONNREFUSED 127.0.0.1:5432 at 
C:\Users\user1\MyProj\node_modules\sequelize\lib\dialects\
postgres\connection-manager.js:98:20 at Connection.

我认为还有一些其他配置需要添加或更改。但我不确定是哪一个。您认为我使用的寡妇/pgadmin 版本是否会导致其中一些错误或 Windows 10 防火墙/安全阻止端口?

4

1 回答 1

0

确保:

1) Postgres db is running
2) pg is installed: 

npm install --save pg

3) Add also protocol to your config
'dialect':'postgres',
'protocol':'postgres'
于 2016-10-03T10:21:37.260 回答