Comments (8)
Might help to mitigate your issue: serve -p 3000
from serve.
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.
Exactly! @derhuerst @timneutkens 😊
from serve.
@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.
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.
@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.
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.
@derhuerst just tested again and now I see an EADDRINUSE
error, so feel free to ignore :D
from serve.
Related Issues (20)
- Do not serve hidden subfolders
- Restore silent mode HOT 2
- `npx serve` throws ENOENT error in [email protected] and newer HOT 1
- serve 14.2.1 CLI arguments issue http to https
- Testing local deployments for GitHub pages doesn't work since no `basePath` can be set HOT 6
- Add cleanUrls option to CLI interface
- IPV6 support
- Publish types for API with npm release
- Node.js 21: "[DEP0040] DeprecationWarning: The `punycode` module is deprecated." HOT 4
- serve didn't work in routing with react-router and vite in production HOT 1
- add --open to the CLI
- Anyway to run npx serve constantly? HOT 3
- `localhost:1234/foo/index.html.html` provokes a 404
- Add a file size limit to etag SHA calculations, fallback to "Last modified" when above this limit.
- Authentication is not available HOT 1
- Node.js 22: "[DEP0040] DeprecationWarning: The `punycode` module is deprecated." HOT 3
- Search functionality
- serve.json double quote escaping handling perfomance issue (\") HOT 1
- `npx serve .` does not always serve the current directory
- Ability to serve `.html.gz`, `.js.gz` `.json.gz` etc. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serve.