sabraman
TTCTheo's Typesafe Cult
•Created by Hueso on 1/27/2025 in #questions
Environment port not used on a local PC
and if you just want to set port to 3500 and not getting it from .env, you could just change
"dev: next dev -p 3500"
4 replies
TTCTheo's Typesafe Cult
•Created by Hueso on 1/27/2025 in #questions
Environment port not used on a local PC
you can add to your package.json:
universal way
"dev:port": "node -e \"process.env.PORT=require('dotenv').config().parsed.PORT;require('next/dist/bin/next')\" dev",
if you are using windows (why? just use wsl)
"dev:port:win": "pwsh -c \"next dev -p ((gc .env)-match'PORT=(.+)'-replace'.*=')\"",
and for linux/macos
"dev:port:unix": "next dev -p $(grep PORT .env | cut -d '=' -f2)",
4 replies