使用pgAdmin4在Windows 10计算机上运行Express项目。
在带有 postgres dialect 的sequelize/config.json
文件中,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"
}
使用postgres方言运行gulp watch
,出现以下错误:
$ 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.
我认为还需要添加或更改其他配置。但我不确定是哪一个。你认为我正在使用的widows / pgadmin版本是否会导致其中一些错误或者Windows 10防火墙/安全阻塞端口?
答案 0 :(得分: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'