question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Couldn't run with db PostgreSQL

See original GitHub issue

Hi, I new here. Went through the Quickstart tutorial and trying to test it out with sqlite and PostgreSQL. sqlite works fine but i cant get PostgreSQL to work. Help is appreciated. Thank you!

ormconfig.json

{
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "test",
    "password": "test",
    "database": "test",
    "synchronize": true,
    "logging": false,
    "entities": [
        "src/entity/**/*.ts"
    ],
    "migrations": [
        "src/migration/**/*.ts"
    ],
    "subscribers": [
        "src/subscriber/**/*.ts"
    ]
}

npm start

{ Error: connect ECONNREFUSED 127.0.0.1:5432 at Object._errnoException (util.js:1019:11) at _exceptionWithHostPort (util.js:1041:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14) code: ‘ECONNREFUSED’, errno: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘127.0.0.1’, port: 5432 }

package.json

{
   "name": "MyProject",
   "version": "0.0.1",
   "description": "Awesome project developed with TypeORM.",
   "devDependencies": {
      "ts-node": "3.3.0",
      "@types/node": "^8.0.29",
      "typescript": "2.5.2"
   },
   "dependencies": {
      "pg": "^7.3.0",
      "reflect-metadata": "^0.1.10",
      "typeorm": "0.1.1"
   },
   "scripts": {
      "start": "ts-node src/index.ts"
   }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

121reactions
pleerockcommented, Oct 23, 2017

no, I mean postgres application. Did you install postgres application ? Do you have experience working with databases at all?

46reactions
ghostcommented, Oct 28, 2019

Since Docker is a virtual machine, you have to use its ip to connect to your database.

If you’re using Windows, try the following command in Docker’s terminal: docker-machine ip Put this ip in HOST (in whatever GUI you’re using, in my case, postbird) instead of using “localhost”.

Make sure you use the correct port as well. You can check which port the database is using by doing docker ps to list any running container. If none is returned in the above command, use docker ps -a to list all containers and then docker start NAME, where NAME is the name of the database you want to start.

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostgreSQL: Why psql can't connect to server? - Stack Overflow
The error states that the psql utility can't find the socket to connect to your database server. Either you don't have the database...
Read more >
15: 19.3. Starting the Database Server - PostgreSQL
Before anyone can access the database, you must start the database server. The database server program is called postgres .
Read more >
Homebrew Postgresql Service not Starting Resolved
This post will cover how to troubleshoot when the postgresql service installed via Homebrew on a Mac isn't starting. If you work on...
Read more >
Why my Rails Projects Couldn't Connect to Postgresql
Whenever you're doing an initial rails setup with postgres you run… $ rails db:setup. this will set up the test and development databases...
Read more >
Setting up a PostgreSQL Database on Mac - SQLShack
Once the postgres server is up and running, the next step is to configure it for use. We are going to create a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found