cyc
cyc copied to clipboard
Weird message: listening on http://::1:3000
When running npm run dev on a fresh project
[dev]
listening on http://::1:3000
Should be listening on http://localhost:3000
I found the bug in skel/index.js
app.listen(port, '::1', err => {
if (err) {
return console.err(err)
}
log(`listening on http://::1:${ port }`)
})
(This issue is the first one when googling for issues with http://::1:8080 in the browser)
Note that ::1 is the IPv6 equivalent for 127.0.0.1 in IPV4. See https://stackoverflow.com/a/40189197/873282 for details.
Direct your browser to http://[::1]:3000/.
(OMG: GitHub's markdown cannot handle that. Following link opens the wrong URL in the browser: http://[::1]:3000/)
How can I fix the same error?
$ rails s
Resolving dependencies...
/home/keaton/.rvm/rubies/ruby-2.6.6/bin/ruby: warning: shebang line ending with \r may cause problems
=> Booting Puma
=> Rails 6.1.4.4 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.5.2 (ruby 2.6.6-p146) ("Zawgyi")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 270
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop