0
使用pgAdmin4在Windows 10計算機上運行我的Express項目。Postgres方言無法正常工作
在sequelize/config.json
文件與postgres方言,Sequelize給出了一些錯誤。
"development": {
"username": "root",
"password": null,
"database": "database_development",
"host": "127.0.0.1",
"port": "5432",
"dialect": "postgres"
}
但隨着sqlite的方言,它工作正常。
"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.
我覺得有一些其他的配置需要添加或更改。但我不確定哪一個。你認爲我使用的widows/pgadmin版本是否會導致這些錯誤或windows 10防火牆/安全性阻塞端口?
我猜中了這一次!我在安裝'pg'時沒有使用'--save',我還通過關閉Windows防火牆並以管理員身份運行它來重新安裝pgAdmin4。我發現'protocol'是可選的,它可以工作在無線協議上,但我只是爲了以防萬一。不過謝謝你,我想不到這樣做。 – mhasan