vercel / serve

Static file serving and directory listing
https://npmjs.com/package/serve
MIT License
9.35k stars 687 forks source link

IPV6 support #787

Open gaurisindu opened 11 months ago

gaurisindu commented 11 months ago

I'm deploying a React application which needs to be able to serve both IPV4 and IPV6 addresses. As of now, Serve seems to be preferring IPV4 addresses. Ideally I'd want it to be pick IPV6 addresses by default.

The version I'm using is 14.2.1

I've deployed the React application and am running the build using Serve, following the React doc's Deployment Page. This is my first time deploying an app, and being completely new to Serve and Node in general, I've not been able to figure out how to do so and would appreciate some guidance and help.

I used serve -h to understand whether I can do something and tried running this

serve -s build -l tcp://[<ipv6-address>]:<port-number>

When I run this I get the following error

Error: Failed to serve: Error: listen EINVAL: invalid argument 
    at Server.setupListenHandle [as _listen2] (node:net:1468:21)
    at listenInCluster (node:net:1533:12)
    at doListen (node:net:1682:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
    at Server.<anonymous> (file:///usr/local/lib/node_modules/serve/build/main.js:236:11)