Coder Social home page Coder Social logo

Why not `localhost:3000`? about serve HOT 8 CLOSED

vercel avatar vercel commented on September 23, 2024
Why not `localhost:3000`?

from serve.

Comments (8)

timneutkens avatar timneutkens commented on September 23, 2024 4

Might help to mitigate your issue: serve -p 3000

from serve.

derhuerst avatar derhuerst commented on September 23, 2024

Also, running on a random port means that every time you restart, you can't just refresh your browser -- you have to paste in the new address.

You'd usually keep this server running, while your code bundler/build system will rebuild your bundles.

from serve.

leo avatar leo commented on September 23, 2024

Exactly! @derhuerst @timneutkens 😊

from serve.

ericsoco avatar ericsoco commented on September 23, 2024

@derhuerst yes, but sometimes you need to restart...it's a minor ergonomic issue, just wondering about the reasoning behind the change.

@timneutkens I already added that to my npm script, again just wondering why the setup here is different than in the previous version of serve (pre 2.0). It amounts to an API change, essentially. I can adapt, just wondering why @leo et al. didn't try to maintain the previous workflow.

from serve.

derhuerst avatar derhuerst commented on September 23, 2024

yes, but sometimes you need to restart

when?

it's a minor ergonomic issue, just wondering about the reasoning behind the change.

Using random ports is in many cases very sensible, as starting the server would usually fail binding a port already used. From what it seems, the setup at now.sh is geared towards random ports.

from serve.

ericsoco avatar ericsoco commented on September 23, 2024

@derhuerst when I make changes to files that are not watched; when my watcher doesn't catch changes due to setup omissions; when i restart my computer and Chrome reopens tabs. It's not common but it's not a fabricated scenario, either.

Interesting you mention failing binding to a port already in use. I had a conflict on port 3000 as I was trying to get serve working, in fact. However, serve seems to fail silently in this case -- the console shows no indication the port is in use. Can open a separate issue if that is actually a bug. Thanks for the now.sh example, makes sense.

from serve.

derhuerst avatar derhuerst commented on September 23, 2024

However, serve seems to fail silently in this case -- the console shows no indication the port is in use. Can open a separate issue if that is actually a bug.

Cannot confirm on master.

from serve.

ericsoco avatar ericsoco commented on September 23, 2024

@derhuerst just tested again and now I see an EADDRINUSE error, so feel free to ignore :D

from serve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.