node http-server not serving updated html files

the two ways that seem to work is changing the port number after each update or going through chrome incognito mode.

Your problem is client-side caching. Incognito mode has its own data directory, independent from your normal browsing.

Fortunately, http-server provides a way for you to set the cache control headers.

-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1 (and possibly -p 8080 to force the server to clear the cache for that port; can be removed on subsequent runs).

It's listed in the documentation here: https://github.com/indexzero/http-server

You can read up on HTTP caching directives here: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=en


Try opening developer tools and checking "disable cache" checkbock in Network tab in Chrome.