Struggling to set custom PORT on remix app, you are not alone!

Its funny that (>2x) app doesn't have a direct config to set PORT.


In DEV environment its fairly easy.


  1. create .env file under project 
  2. set PORT variable and assign it a value

    PORT = 4001

In PROD environment its NOT fairly easy. :D

If you are using Mac, you can pass PORT=XXXX as a flag to remix run start script.

PORT=4001 remix-serve ./build/index.js

BUT if you are using windows, it wont work :(

For windows, you have to install 



and set the script like this


cross-env PORT=4001 remix-serve ./build/index.js

Well, its the only way I have found out in the Internet, and it works :)