Why isn't npm start not building and connecting to the dev server? - node.js

I'm trying to work my way through a React course and I am consistently running into the same issue. Every time I use npm start after I've created the app I get this error in the browser: This site can’t be reached. Localhost took too long to respond or I get the error that it refused to connect.
Here's everything I've tried to remedy the issue:
I'm not getting any errors in VScode's built in terminal or my laptop's terminal, it says everything compiled successfully.
I've tried opening the dev server on multiple different browsers: Brave, Chrome, Firefox.
I've created multiple different projects & all are having the same issue.
I've changed the port the dev server opens up on in VScode.
I've cleared my node cache.
I've uninstalled & reinstalled node & npm.
I've restarted my laptop multiple times
I've uninstalled & reinstalled VScode.
I even went so far as to completely factory reset my laptop & reinstall everything. It fixed the problem for a couple of days but now I'm back at square one dealing with the same issue.
My laptop is a 2017 MBP 13 running macOS Monterey. Any help / advice would be greatly appreciated.
curl -v "http://localhost:3000"
Trying 127.0.0.1:3000...
* Trying ::1:3000...
* connect to ::1 port 3000 failed: Connection refused
* connect to 127.0.0.1 port 3000 failed: Operation timed out
* Failed to connect to localhost port 3000 after 25918 ms: Operation timed out
* Closing connection 0
curl: (28) Failed to connect to localhost port 3000 after 25918 ms: Operation timed out
```

I finally figured out the solution. I had to turn off my VPN for the npm start command to work.

Related

Can't open couchdb

I am a beginner to CouchDB, I need to do a school assignment with it, but now it crashed on my computer. My system is mac os, when I open the couchDB application, it keeps popping new admin windows(http://127.0.0.1:5984/_utils/#login?urlback=), but all of them are failed to connect.
When I try:
curl -X PUT http://127.0.0.1:5984
it returns
curl: (7) Failed to connect to 127.0.0.1 port 5984: Connection refused
It worked well on my computer before, seems after I tried to setup a remote node, it crashed.
What should I do to fix it?

localhost:3000 connection refused after app.js is set (Windows 7)

I've followed this manual of installing MEAN stack https://thecodebarbarian.wordpress.com/2013/07/22/introduction-to-the-mean-stack-part-one-setting-up-your-tools/
and I got stuck on the point where I should be able reach for localhost:3000 successfully, but instead I get ERR_CONNECTION_REFUSED. I checked the ports using
netstat -an
and it seems my port 3000 is not even open. My Apache is working on port 80 and after reaching for localhost:80 everything works fine (I even checked if closing the Apache helps). The only thing I changed in the manual is that I installed both express and express-generator thanks to this install express with npm.
Can anybody tell me what should I do additionally so my port 3000 responds?
EDIT: I also checked the host files in system32, the only localhost address I have is 127.0.0.1 (three times, though!)
EDIT2: Solved, same issue as here: Express Node.js doesn't work
Remember to change the app.js file in the folder you are currently working in!

Getting "The connection to 'localhost' failed" error when trying to browse localhost site on IIS

My localhost IIS sites recently stopped working and I can't figure out why. If I try and browse to http://localhost after a while I get the error Oops! Google Chrome could not connect to localhost. If I open Fiddler and try again I get a 502 error that states System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 127.0.0.1:80
I've tried using netstat -a -b to see if any other applications are blocking port 80, but there doesn't appear to be anything obvious.
I've disabled proxy servers and that doesn't have any affect.
As a last resort I even tried re-installing IIS
Everything has been working fine and I can't think of any configuration changes that would've stopped localhost from working. Any ideas?

unable to run express 2.5.8 on ubuntu 11 on amazon aws

I am using express 2.5.8 on ubuntu 11 (amazon aws). I have connect 1.7.2 & node 0.6.15. I am able to run node (listen on port 3000 for instance) - however, when I use express, it appears to throw the following error:
got an uncaught error: Uncaught, unspecified 'error' event
There is no other service bound on that port at that time - I have tried re-installing express 2.5.8 and connect 1.7.2 (work on local box) - any insight to troubleshoot the issue more quickly will be greatly appreciated. Once again, the code (using express runs fine on local box - on server, I can run a non express node server on that same port (I close it down before I run the express server instance).
Thanks
Pilot error - the issue was with the redis connection pwd (I had to fix it in my code to match the pwd in the redis.conf to resolve the issue ). Added better handling (which I should have done to begin with).
Thank you Wes for commenting - appreciated.

socket.io example not working - Windows

Im using Node.js 0.6.2 on Windows 7
I managed to get the dependencies solved on Win7 for socket io, now when i launch one of the example apps it doesnt throw any errors.
however, for the IP and listener it reports its listening on , when i launch that in the browser, the connection times out.
Any ideas?
I've tried setting app.listen to different ports and IP addresses, but no luck.
Just for reference, i've tried the famous "hello world" Node.js example which works fine.
Things i've already checked
Other services running on the same ports or same listener IP
Different IP addresses and ports
Firewall / Port blocking
Restarting of the machine
dependencies in node_modules
Different browsers
Telnetting to the listener port (which shows a response so the listener must be working?)
So this works for me (running msysGit and node.js, both latest versions; both Windows installers):
$ cd c:\msysgit\msysgit\cmd
$ git clone git://github.com/ry/node_chat.git
$ cd node_chat
$ "c:\progra~1\nodejs\node.exe" server.js
I can open 127.0.0.1:8001 now and run it. The fact that you have to cd into the directory is a bug in node_chat, same behavior is in OS/X.
I managed to solve this problem with some outside help.
I downloaded Node 0.6.3 which comes with NPM.
I created a test folder and then ran NPM Install socket.io express within the test folder and then tested the example app from the Socket IO website in the how-to-use section.
Socket IO emitted the events fine and it all seems to be working well. Thanks everyone for the help and guidance.

Resources