Try to setup Twenty on local
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! πTwenty - Local Setup
Mostly for contributors or curious developers
18 Replies
Which step did you follow? It seems redis is missing
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.
Is redis running properly?
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]
π
any idea @Weiko@JΓ©rΓ©my can you run the commands separately and provide better error messages? Hard to understand what is failling there π
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?
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 messageI 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]
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;"@JΓ©rΓ©my do you have postgres running when you do
brew services
(nevermind, I read the error too quickly, you clearly reach your SQL server there)yes
@FΓ©lix is it linked to the upgrade?
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
in the packages/twenty-server/.env i have :
PG_DATABASE_URL=postgres://postgres:twenty@localhost:5432/default
This command created a user named "twenty' for you, use that one instead π
You should have
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default
seems ok for database,
i have new errors now aha
@FΓ©lix I think we should update the docs for people running their own SQL server and not running spilo? Seems not up to date π
What's the error? π
Its okkkk thats working !!!
thanks a lot @Weiko @thomast
Great π