0

Running my Express project on a Windows 10 machine with pgAdmin4.

In sequelize/config.json file with postgres dialect, Sequelize gives some error.

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

But with sqlite dialect, it works fine.

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

Running gulp watch with postgres dialect, following errors come up:

$ 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.

I think there are some other configuration need to be added or changed. But I am not sure which one. Do you think the widows/pgadmin version I am using, are causing some of these errors or windows 10 firewall/security blocking the port?

mhasan
  • 15
  • 4

1 Answers1

0

Make sure:

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

npm install --save pg

3) Add also protocol to your config
'dialect':'postgres',
'protocol':'postgres'
Andrzej Karpuszonak
  • 8,896
  • 2
  • 38
  • 50
  • I got it right this time! I didn't use `--save` while installing `pg`, I also reinstall pgAdmin4 with turning off the windows firewall and run it as an administrator. I found `protocol` is optional, it works w/out protocol, but I'm using just in case. Thank you though, I couldn't think of doing in this way. – mhasan Oct 04 '16 at 06:36