local host wont connect
Unanswered
Anna's Hummingbird posted this in #help-forum
Anna's HummingbirdOP
Hello, so I am in the process of making my own blog as a project and I did it with javascript, html, and css. I basically made a good starting point with it, like a basic outline and being able to turn it from light mode to dark mode. This went, however, I wanted to start using next.js to make the blog. The setting up took a whole day but I finally set up the folder in the folder that the code for my blog was in. It was working fine yesterday, but suddenly, I can't host either pages on chrome anymore, it stopped working. When I would run it, it would say Launch Chrome against localhost, which is unusual as it usually just says run and debug. And when I would run it either way I would get url": "http://localhost:8080", which is not the usual host. Not only that, but it would say localhost refused to connect. Please let me know what I can do!
15 Replies
@Dayo how are you running the server?
Anna's HummingbirdOP
honestly, I'm unsure, this is the first time I've done a project, but as far as I am aware it is a local host that uses launches http://localhost:3000/, which is also what the launch.json file usually says when I run it.
This may be totally unhelpful. so sorry for that
i'm fairly new to all of this
try opening a new terminal in your project and run
if you're using VS code, you should see the terminal option at the top
npm run devif you're using VS code, you should see the terminal option at the top
Anna's HummingbirdOP
- error Failed to start server
Error: listen EADDRINUSE: address already in use :::3001
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
at listenInCluster (node:net:1920:12)
at Server.listen (node:net:2008:7)
at C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\server\lib\start-server.js:153:16
at new Promise (<anonymous>)
at startServer (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\server\lib\start-server.js:134:11)
at setupFork (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:448:75)
at runDevServer (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:457:23)
at async nextDev (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:566:9) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3001
}
Error: listen EADDRINUSE: address already in use :::3001
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
at listenInCluster (node:net:1920:12)
at Server.listen (node:net:2008:7)
at C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\server\lib\start-server.js:153:16
at new Promise (<anonymous>)
at startServer (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\server\lib\start-server.js:134:11)
at setupFork (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:448:75)
at runDevServer (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:457:23)
at async nextDev (C:\Users\pamul.vscode\myblog\nextjs-blog\node_modules\next\dist\cli\next-dev.js:566:9) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 3001
}
this is the error i got
after doing so
run
and then run
npx kill-port 3000and then run
npm run dev againalso, send a screenshot of your package.json file
Anna's HummingbirdOP
here is the package and here is what happens when i run npm run dev
wait it works except now the first html file i created runs as the new next.js file i created
follow the next js docs on how to bootstrap a new project - https://nextjs.org/docs/getting-started/installation
@Anna's Hummingbird here is the package and here is what happens when i run npm run dev
Muscovy Duck
Seems like you're running npm run dev from your home directory, not from the project itself.