Stuck on waiting for localhost

answered
#1

Hi,

I tried Netlify Dev on an existing Netlify site powered by Gatsby (which deploys fine), but when running the netlify dev command it stops after “Waiting for localhost”:

mbp-van-simon:personalsite simon$ netlify dev --live
Netlify Dev ◈ Starting Netlify Dev...
Netlify Dev ◈ Starting Netlify Dev with gatsby
Waiting for localhost:8000.mbp-van-simon:personalsite simon$

Site is linked correctly and gatsby develop is working fine as well. Any ideas on how to debug this? :grinning:

#2

Hey simon, just to check do you have the latest version of the cli? Also, do you have anything else running on 8000? Just thought I’d ask as I’ve been tripped up by those things

#3

Hi David, thanks. Yeah, I’ve updated the cli (I just forced a reinstall like the readme recommended). And no, port 8000 is free. I can actually run gatsby develop without issues on it right after trying netlify build.

#4

Same issue with brand new nextjs project. What are we missing here? Do I need some sort of config file before running netlify dev command. I am mostly interested in running Netlify functions locally to test them. I’m guessing netlify dev is not meant to be used to hot reload for development. Tell me if I am wrong.

#5

My issue was that i was using a custom port in my npm run dev command to start Gatsby. When I removed the custom port and let it default, it worked fine. Does Netlfy Dev not work with custom Gatsby dev ports?

#6

I got it to work by calling this command netlify dev -c "npm run dev"

My prob now is that my local functions are not built? I added a function using netlify functions:create it’s in a folder. When I launch the site I can’t get to the function URL. NextJS just gives me a template 404 page. Is there something I am missing here?

#7

hello! i work on Netlify Dev. if you can share your repo i can debug quicker, if not its cool.

if youre using npm instead of yarn (i.e. you have a package-lock.json), we had a bug that i just fixed right now. https://github.com/netlify/netlify-dev-plugin/issues/110 you can update your CLI again (npm i -g netlify-cli) to v2.11.5 to try again.

however this bug only fixes the issue where your process was terminating after the “waiting for localhost” message. if your terminal was -hanging- there, then this will probably not fix it. either way let me know.

1 Like
#8

@swyx That fixed it for me, thank you for the quick fix! :slight_smile:

#9

lol… so it turns out like only 10 people use npm… everyone else used yarn including meso i didnt know about this bug

1 Like
#10

CLI version is up to date:

+ netlify-cli@2.11.11

But when running:

$ netlify dev --live

It just hangs:

◈ Netlify Dev ◈
◈ Starting Netlify Dev with jekyll
Waiting for localhost:4000…

#11

What’s the result of running netlify dev without the --live flag, does it hang as well? It would seem that the tool is expecting to be able to start the local Jekyll dev server on port 4000, but that it never becomes available after running the underlying server command…

#12

Howdy Matt :cowboy_hat_face:

Same result without the --live flag

Even tried a different site with the same results. Must be a problem with how we have Jekyll set-up.

Tried a different site without Jekyll and…

◈ Server now ready... :partying_face:

This makes me happy. You sir, have changed the World.

Web developer since the 90’s and Netlify makes the best tools ever. Thank you so much for what you do!

#13

Running into this issue again. With a Gatsby project this time.

Steps

  1. Start with Universal Starter on Netlify
  2. Clone repository
  3. Install Node packages
npm install netlify-cli -g
netlify dev

Results

◈ Netlify Dev ◈
◈ Starting Netlify Dev with gatsby
Waiting for localhost:8000
#16

@earth2travis, I think the issue you are seeing is related to an existing open issue. You could add your comments there which hopefully help debug the issue further.

#17

Appreciate it Dennis. Have been having some permissions errors. Completely wiped my hard drive and reinstalled OS X. Will update if I encounter this issue again.

1 Like