I'm trying to develop a series of SvelteKit apps for my business. I want to run them all on the same Windows Server using Node; they're fairly small.
I can deploy the first one (using the SvelteKit Node adapter) fine on port 3000. However, the next app I build & try to deploy wants port 3000 as well, and naturally I get a Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
error. I can use port 4000 for app #2, 5000 for app #3, etc. This is pretty easy to setup using host headers in IIS & URL Rewrite. However, I cannot find a way to declare a specific port anywhere.
My question: How do I specify the port I'd like to serve each SvelteKit project on?
I've seen a few posts & blogs on this... Here's what I've tried:
Creating a
.env
file at the project root withCUSTOM_PORT=4000
& aenvPrefix: 'CUSTOM_'
directive in the adapter() insvelte.config.js
. This simply gets ignored.Starting the build with
PORT=4000 node build
. This results in an error:The term 'CUSTOM_PORT=4000' is not recognized as the name of a cmdlet, function, script file, or operable program
.I've tried variations like
node build PORT=4000
,node build --PORT=4000
, etc. All produce the EADDRINUSE error.