Unable to host on ports different from 3000 #13408
Replies: 2 comments 1 reply
-
That is not how According to the docs, you can just set the variables for the PORT=3001 pm2 ... The |
Beta Was this translation helpful? Give feedback.
-
thanks. Initially, I had the variable in front like you said, same outcome but I never had it on built too. Will try that tomorrow and report back |
Beta Was this translation helpful? Give feedback.
-
I am struggling to host my svelte kit application on ports other than 3000. I do not know what I am doing wrong either. Maybe you guys have an idea. I run more than one application on this machine, hence the need for a different port, 3001 maybe. Anyway, I use pm2 so I thought
pm2 start index.js --name app-2 --env PORT=3001
would do the trick. It did not.
The next idea was to change `vite.config.ts
When I build it like this, I do get
const port = env('PORT', !path && '3000');
in mybuild/index.js
file, surprisingly.The only way I can pull this off is if I go into that file and modify it to
const port = env('PORT', !path && '3001');
after building and then run pm2, that works, but that's not practical because every time I make a change to the application I am going to have to manually do this, and that's no good.Beta Was this translation helpful? Give feedback.
All reactions