TLDR: If you are using a Mac, don't edit your
hosts file with Nano and save it in Mac format. It will cause bizarre bugs in places you won't expect. If you are seeing bugs on a Mac with errors saying
localhost is missing, try opening the
hosts file and save it with Unix line ending.
I learned this while working on a React Native project, where Expo's development server just wouldn't start up. After a long and patient wait, an elaborate error message showed up. In which the most eye-catching line said:
RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received 65536. ⋯