Two instances of ntl dev

I’m trying to run two instances of netlify dev with two different Eleventy sites. For site A, I use the defaults:

netlify dev -c "eleventy --serve --quiet"

And site A pops up just fine. For site B, I wanted to change the ports for both Netlify and Eleventy, so I did:

ntl dev -p 9999 -c "npx eleventy --serve --port 9998"

It correctly opens a browser window to port 9999, but it’s using Site A, not B. If I switch to port 9998, I can see site B is running there, but I need both to be using netlify dev.

Is that possible?

I should add, if I do not pick a port for netliy dev, it correctly recognizes I’ve got another instance running and uses a new port, but I still see site A, not site B.

Hey @cfjedimaster,

I’m not able to reproduce this.

Here’s what I see:

I’m not using eleventy, but I believe the behaviour should be similar.

I ran netlify dev in the one in the left and netlify dev -p 9999 for the one in the right. Both the sites are static, as in there’s no server being run by any SSG. So, netlify cli is simply serving these sites. Maybe that’s where the difference lies? Could you confirm this behaviour?

I’m sure it works as you described, but the use of two ports for “eleventy serve” is the difference. Could you test as I described?

You need to specify this in netlify.toml for the site with the second command:

[dev]
  framework = "#custom"
  targetPort = 9998

Because otherwise, Netlify CLI will proxy for the default Eleventy port and the first app is being served on that one.

2 Likes

One note - when I tried this I got:

 'command' and 'targetPort' properties are required when 'framework' is set to '#custom'

I had forgotten the -c command. I figured it would be nice to do it all in the tomo so I’m using this:

command = "eleventy --serve"
framework = "#custom"
targetPort = 9_998
1 Like

That’s for following up and letting us know! We appreciate it.