Home > OS >  Why isn't npm start not building and connecting to the dev server?
Why isn't npm start not building and connecting to the dev server?

Time:09-21

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
```

CodePudding user response:

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

  • Related