T
Twenty3w ago
Rico

Server won't change port from 3000 to 50008

hi everyone! I tried a self hosted approach (no docker!) and wanted to switch ports from 3000 and 3001 to 50008 and 50009 … yet, whenever I start the server it tells me, that port 3000 is already in use. yeah … that's why I want to switch to port 50008 instead 😉
# $> cat packages/twenty-server/.env
NODE_ENV=development
PG_DATABASE_URL=postgres://postgres:passwordremoved@localhost:5432/default
REDIS_URL=redis://localhost:6389
APP_SECRET=replace_me_with_a_random_string
SIGN_IN_PREFILLED=true
FRONTEND_URL=http://twenty.my-custom-domain.com:50009
PORT=50008
SERVER_URL=http://twenty.my-custom-domain.com:50008
# $> cat packages/twenty-server/.env
NODE_ENV=development
PG_DATABASE_URL=postgres://postgres:passwordremoved@localhost:5432/default
REDIS_URL=redis://localhost:6389
APP_SECRET=replace_me_with_a_random_string
SIGN_IN_PREFILLED=true
FRONTEND_URL=http://twenty.my-custom-domain.com:50009
PORT=50008
SERVER_URL=http://twenty.my-custom-domain.com:50008
Was anyone successful running twenty server on any other port than 3000? Thanks for your replies in advance! Rico
8 Replies
Antonio Pinto
Antonio Pinto3w ago
I guess you are using Docker? If so, you also need to adjust the settings on your
docker-compose.yml
docker-compose.yml
Can you share yours?
Rico
RicoOP3w ago
Hi @Antonio Pinto I'm not using docker … I used git clone and used npx to start server, frontend and worker. Here's the shell output:
NX Running target start for project twenty-server and 5 tasks it depends on:

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run twenty-shared:generateBarrels [existing outputs match the cache, left as is]


> nx run twenty-shared:build [existing outputs match the cache, left as is]


> nx run twenty-emails:build [existing outputs match the cache, left as is]


> nx run twenty-server:typecheck [existing outputs match the cache, left as is]

> tsc -b tsconfig.json --incremental


> nx run twenty-server:build [local cache]

> rimraf dist

> nest build --path ./tsconfig.build.json

> SWC Running...
Successfully compiled: 2309 files with swc (307.86ms)

> nx run twenty-server:start

> NODE_ENV=development && nest start --watch

> SWC Running...
Successfully compiled: 2309 files with swc (947.54ms)
Watching for file changes.
Frontend build not found, assuming it is served independently
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1817:16)
at listenInCluster (node:net:1865:12)
at Server.listen (node:net:1953:7)
at ExpressAdapter.listen (/var/www/share/twenty/node_modules/@nestjs/platform-express/adapters/express-adapter.js:88:32)
at /var/www/share/twenty/node_modules/@nestjs/core/nest-application.js:180:30
at new Promise (<anonymous>)
at NestApplication.listen (/var/www/share/twenty/node_modules/@nestjs/core/nest-application.js:169:16)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at bootstrap (/var/www/share/twenty/packages/twenty-server/src/main.ts:90:3)
NX Running target start for project twenty-server and 5 tasks it depends on:

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run twenty-shared:generateBarrels [existing outputs match the cache, left as is]


> nx run twenty-shared:build [existing outputs match the cache, left as is]


> nx run twenty-emails:build [existing outputs match the cache, left as is]


> nx run twenty-server:typecheck [existing outputs match the cache, left as is]

> tsc -b tsconfig.json --incremental


> nx run twenty-server:build [local cache]

> rimraf dist

> nest build --path ./tsconfig.build.json

> SWC Running...
Successfully compiled: 2309 files with swc (307.86ms)

> nx run twenty-server:start

> NODE_ENV=development && nest start --watch

> SWC Running...
Successfully compiled: 2309 files with swc (947.54ms)
Watching for file changes.
Frontend build not found, assuming it is served independently
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1817:16)
at listenInCluster (node:net:1865:12)
at Server.listen (node:net:1953:7)
at ExpressAdapter.listen (/var/www/share/twenty/node_modules/@nestjs/platform-express/adapters/express-adapter.js:88:32)
at /var/www/share/twenty/node_modules/@nestjs/core/nest-application.js:180:30
at new Promise (<anonymous>)
at NestApplication.listen (/var/www/share/twenty/node_modules/@nestjs/core/nest-application.js:169:16)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at bootstrap (/var/www/share/twenty/packages/twenty-server/src/main.ts:90:3)
Antonio Pinto
Antonio Pinto3w ago
Ok! Checking https://twenty.com/developers/section/self-hosting/setup#setup-environment-variables You might need:
REACT_APP_SERVER_BASE_URL=http://twenty.my-custom-domain.com:50008
REACT_APP_SERVER_BASE_URL=http://twenty.my-custom-domain.com:50008
Rico
RicoOP3w ago
Hi @Antonio Pinto thanks for your reply. I do have that. Let me copy my .env file for reference as well: Front
REACT_APP_SERVER_BASE_URL=http://twenty.my-custom-domain.com:50008
VITE_BUILD_SOURCEMAP=false
VITE_DISABLE_ESLINT_CHECKER=true

REACT_APP_PORT=50009
VITE_HOST=twenty.my-custom-domain.com
REACT_APP_SERVER_BASE_URL=http://twenty.my-custom-domain.com:50008
VITE_BUILD_SOURCEMAP=false
VITE_DISABLE_ESLINT_CHECKER=true

REACT_APP_PORT=50009
VITE_HOST=twenty.my-custom-domain.com
I would assume that this is all correct, isn't it?
Antonio Pinto
Antonio Pinto3w ago
I assume you have SITE_HOST and not VISTE_HOST Maybe try to clear the nx cache? The places with PORTS are:
REACT_APP_SERVER_BASE_URL = http://localhost:3000
SERVER_URL = http://localhost:3000
FRONTEND_URL = $SERVER_URL #same as SERVER_URL by default
PORT = 3000
REACT_APP_SERVER_BASE_URL = http://localhost:3000
SERVER_URL = http://localhost:3000
FRONTEND_URL = $SERVER_URL #same as SERVER_URL by default
PORT = 3000
Rico
RicoOP3w ago
it's VITE_HOST according to .env.example file: https://github.com/twentyhq/twenty/blob/main/packages/twenty-front/.env.example … should it be SITE_HOST instead?! nx has a cache? that's a good hint. I'll check that and come back here!
Frontend build not found, assuming it is served independently
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
Error: listen EADDRINUSE: address already in use :::3000
Frontend build not found, assuming it is served independently
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
query: SELECT * FROM current_schema()
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"
query: SELECT version();
Error: listen EADDRINUSE: address already in use :::3000
That didn't help 😕 it still wants to use port 3000 … I really don't understand it 😕 Perhaps there's some other idea?!
Antonio Pinto
Antonio Pinto3w ago
Thats quite strange. I assume you tried a fresh install?
Rico
RicoOP3w ago
yepp … I'm glad that it doesn't make sense to you as well 😄 I thought I did oversee something. Do you know someone else who might have another idea?

Did you find this page helpful?