admin管理员组文章数量:1399933
I've been running a Node server that connects to a Postgresql DB (via Knex). Everything was working absolutely fine and as intended until my laptop crashed. Since restarting, the DB connection will not work at all, and I get the following error:
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as onplete] (net.js:1141:16)
Attempting a Postgresql connection via DBeaver also results in the same error. My server itself can start up absolutely fine. I only get the error when making an API call that tries to connect to the DB. My DB connection set up looks like this:
const db = knex({
client: 'pg',
connection: DATABASE_URL,
});
Again, this was all working perfectly until my laptop crashed. I'm guessing something happened during that process, but I'm not sure what or how to fix it. Any ideas/advice would be appreciated!
Full npm log below:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/<name>/.nvm/versions/node/v12.16.2/bin/node',
1 verbose cli '/Users/<name>/.nvm/versions/node/v12.16.2/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: /Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/<name>/Desktop/BLOC/productify-server/node_modules/.bin:/Users/<name>/.nvm/versions/node/v12.16.2/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/<name>/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/<name>/Downloads/apache-maven-3.6.1 :/usr/local/share/dotnet
9 verbose lifecycle [email protected]~dev: CWD: /Users/<name>/Desktop/BLOC/productify-server
10 silly lifecycle [email protected]~dev: Args: [ '-c', 'nodemon src/server.js' ]
11 silly lifecycle [email protected]~dev: Returned: code: 130 signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `nodemon src/server.js`
13 verbose stack Exit status 130
13 verbose stack at EventEmitter.<anonymous> (/Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (/Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/<name>/Desktop/BLOC/productify-server
16 verbose Darwin 19.4.0
17 verbose argv "/Users/<name>/.nvm/versions/node/v12.16.2/bin/node" "/Users/<name>/.nvm/versions/node/v12.16.2/bin/npm" "run" "dev"
18 verbose node v12.16.2
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 130
22 error [email protected] dev: `nodemon src/server.js`
22 error Exit status 130
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 130, true ]
I've been running a Node server that connects to a Postgresql DB (via Knex). Everything was working absolutely fine and as intended until my laptop crashed. Since restarting, the DB connection will not work at all, and I get the following error:
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as onplete] (net.js:1141:16)
Attempting a Postgresql connection via DBeaver also results in the same error. My server itself can start up absolutely fine. I only get the error when making an API call that tries to connect to the DB. My DB connection set up looks like this:
const db = knex({
client: 'pg',
connection: DATABASE_URL,
});
Again, this was all working perfectly until my laptop crashed. I'm guessing something happened during that process, but I'm not sure what or how to fix it. Any ideas/advice would be appreciated!
Full npm log below:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/<name>/.nvm/versions/node/v12.16.2/bin/node',
1 verbose cli '/Users/<name>/.nvm/versions/node/v12.16.2/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: /Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/<name>/Desktop/BLOC/productify-server/node_modules/.bin:/Users/<name>/.nvm/versions/node/v12.16.2/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/<name>/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/<name>/Downloads/apache-maven-3.6.1 :/usr/local/share/dotnet
9 verbose lifecycle [email protected]~dev: CWD: /Users/<name>/Desktop/BLOC/productify-server
10 silly lifecycle [email protected]~dev: Args: [ '-c', 'nodemon src/server.js' ]
11 silly lifecycle [email protected]~dev: Returned: code: 130 signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `nodemon src/server.js`
13 verbose stack Exit status 130
13 verbose stack at EventEmitter.<anonymous> (/Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:310:20)
13 verbose stack at ChildProcess.<anonymous> (/Users/<name>/.nvm/versions/node/v12.16.2/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:310:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/<name>/Desktop/BLOC/productify-server
16 verbose Darwin 19.4.0
17 verbose argv "/Users/<name>/.nvm/versions/node/v12.16.2/bin/node" "/Users/<name>/.nvm/versions/node/v12.16.2/bin/npm" "run" "dev"
18 verbose node v12.16.2
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 130
22 error [email protected] dev: `nodemon src/server.js`
22 error Exit status 130
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 130, true ]
Share
Improve this question
asked Jun 1, 2020 at 15:34
ammamm
431 gold badge1 silver badge7 bronze badges
1
- @valdeci thank you! Don't know how I overlooked this. Everything is fixed now. – amm Commented Jun 1, 2020 at 16:42
1 Answer
Reset to default 3You are having a problem with your PostgreSQL in your Windows machine, try to restart your PostgreSQL server using the following mand:
pg_ctl -D "C:\Program Files\PostgreSQL\9.6\data" restart
If this does not solve your problem, try to look at the logs where the problem is.
The logs are available on the dir %PROGRAMFILES%\PostgreSQL\9.3\data\pg_log
(adjusting for your PostgreSQL version and where you installed PostgreSQL if you didn't use the defaults).
本文标签:
版权声明:本文标题:javascript - NodePostgresql Error: connect ECONNREFUSED 127.0.0.1:5432 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:11 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744211521a2595439.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论