#Try to setup Twenty on local

1 messages · Page 1 of 1 (latest)

weary wigeon
#

Hello,

I tried following this documentation (https://twenty.com/developers/local-setup) to set up a local installation on my Mac. However, I encountered the following error when running npx nx start:

[0] [Nest] 54095 - 22/11/2024 10:22:01 ERROR [ExceptionHandler] connect ECONNREFUSED ::1:6379 [0] Error: connect ECONNREFUSED ::1:6379

Do you have any solution for this?
(I am a junior developer.)
Thank you in advance! 😊

hoary pagoda
#

Which step did you follow? It seems redis is missing

weary wigeon
#

I unzipped Twenty.
I already have PostgreSQL, so I simply created the database.
I installed Redis using Brew (7.2.6).
Then, I followed steps 5, 6, and 7 as explained.

hoary pagoda
#

Is redis running properly?

weary wigeon
#

Redis wasn't properly started, that was my mistake.
Now, when I run the command npx nx database:reset twenty-server, I get the following errors:

`NX Ran target typeorm for project twenty-server (1s)
With additional flags:
migration:run --d=src/database/typeorm/metadata/metadata.datasource
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]

Warning: command "nx typeorm -- migration:run -d src/database/typeorm/metadata/metadata.datasource" exited with non-zero status code

NX Ran target database:migrate for project twenty-server and 2 task(s) they depend on (2s)

✖ 1/3 failed
✔ 2/3 succeeded [2 read from cache]

Warning: command "nx database:migrate" exited with non-zero status code

NX Ran target database:reset for project twenty-server and 2 task(s) they depend on (33s)

✖ 1/3 failed
✔ 2/3 succeeded [2 read from cache]`
😅

weary wigeon
#

any idea @hoary pagoda

ancient lily
#

@weary wigeon can you run the commands separately and provide better error messages? Hard to understand what is failling there 🙂

weary wigeon
#

I didn't properly understand your request earlier, I think. The previous errors appear when I run npx nx database:reset twenty-server
How can I run this commands separately?

ancient lily
#

Could for example try to run npx nx run twenty-server:typeorm -- migration:run -d src/database/typeorm/metadata/metadata.datasource.ts and share the error message

weary wigeon
# ancient lily Could for example try to run `npx nx run twenty-server:typeorm -- migration:run ...

I have this error message

`Error during migration run:
error: role "postgres" does not exist
at Parser.parseErrorMessage (/Users/cap/Documents/www/twenty-main/node_modules/pg/node_modules/pg-protocol/src/parser.ts:369:69)
at Parser.handlePacket (/Users/cap/Documents/www/twenty-main/node_modules/pg/node_modules/pg-protocol/src/parser.ts:188:21)
at Parser.parse (/Users/cap/Documents/www/twenty-main/node_modules/pg/node_modules/pg-protocol/src/parser.ts:103:30)
at Socket.<anonymous> (/Users/cap/Documents/www/twenty-main/node_modules/pg/node_modules/pg-protocol/src/index.ts:7:48)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 100,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'miscinit.c',
line: '710',
routine: 'InitializeSessionUserId'
}
Warning: command "ts-node ../../node_modules/typeorm/cli.js migration:run -d src/database/typeorm/metadata/metadata.datasource.ts" exited with non-zero status code
———————————————————————————————————————————————————————————————————————————————————————————————————————————————

NX Ran target typeorm for project twenty-server (1s)

  With additional flags:
    migration:run
    --d=src/database/typeorm/metadata/metadata.datasource.ts

✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]`

weary wigeon
#

i create my database with :
psql postgres -c "CREATE DATABASE "default";" -c "CREATE DATABASE test;" -c "CREATE USER twenty PASSWORD 'twenty';" -c "ALTER ROLE twenty superuser;"

hoary pagoda
#

@weary wigeon do you have postgres running when you do brew services (nevermind, I read the error too quickly, you clearly reach your SQL server there)

weary wigeon
#

yes

ancient lily
#

@main heart is it linked to the upgrade?

hoary pagoda
#

What's in your server .env? PG_DATABASE_URL

#

Seems like it's trying to connect with 'postgres' user which is not the standard way I believe

weary wigeon
#

in the packages/twenty-server/.env i have :
PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/default

hoary pagoda
#

You should have
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default

weary wigeon
#

seems ok for database,
i have new errors now aha

hoary pagoda
#

@main heart I think we should update the docs for people running their own SQL server and not running spilo? Seems not up to date 🙂

hoary pagoda
weary wigeon
#

Its okkkk thats working !!!

#

thanks a lot @hoary pagoda @ancient lily

hoary pagoda
#

Great 🙂