Home
Support Forums

Netlify CLI/Eleventy question

I think this is a best practices question.

I’m trying to figure out which command I should be running with Netlify CLI. Netlify recommends eleventy --serve, but that already fires up Browsersync, which means I now have servers running on 8080 and 8888.

The docs also recommend using 8080, but that conflicts with Browsersync. Is the solution here just as simple as ignoring the server running on 8888?

package.json:

  "scripts": {
    "start": "netlify dev",
    "build": "NODE_ENV=production eleventy",
    "dev": "FORCE_COLOR=true eleventy --serve"
  },

netlify.toml:

[build]
  command = "npm run build"
  publish = "dist"

[dev]
  command = "npm run dev"
  # port = 8080

Netlify CLI needs your SSG’s server to run. In any case, your app’s server is going to run and Netlify CLI is going to proxy the requests to that server.

Note that, Netlify-specific features like Functions and redirects would only work with 8888 (the port that CLI is running on).

1 Like

OK that makes sense.

So just to be completely clear… 11ty/Browsersync on 8080 and Netlify Dev on 8888 are preferred, correct?

Here’s what the docs say:

If you’re using the CLI to run Netlify Dev for a local development environment, Netlify also suggests a dev command and port: eleventy --serve and 8080.

I don’t think it’s about preference here. It’s just the way it’s supposed to work - kind of like expected behaviour.

Which docs are these? Could you link them? Before commenting on the accuracy, I’d like to see the context to make sure I’m not missing anything.

Sure thing: Eleventy on Netlify | Netlify Docs

Yes, I believe that it’s talking about running the Eleventy server on port 8080 (that the default, I believe). So it should work normally.