Netlify cli build quirks - links not working and port numbers differ?

I’ve just started using netlify-cli locally. Set-up was a breeze. However,
building via netlify dev or netlify dev --live results in a site where the links don’t work on port 8888 or tunnel. Whilst they point to the correct url, clicking only loads the homepage. The same site deploys successfully via netlify/github commit.

Also, see below:

Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address
Press Ctrl+C to stop
✔ Waiting for framework port 1313. This can be configured using the 'targetPort' property in the netlify.toml

   │                                                 │
   │   ◈ Server now ready on http://localhost:8888   │
   │                                                 │

Note the differing port numbers. Why the differing ports? 1313 works as expected, 8888 doesn’t.

Any idea what I’m doing wrong?

What do you mean by doesn’t work? What do they do?

Again, please explain what does “does’t work as expected” mean here?

CLI doesn’t build your site - your app’s command (in your case, Hugo) does. CLI simply proxies the content served by your app’s server. The request goes from like:

Browser → CLI → App

and response comes as:

App → CLI → Browser

So, the app’s server is needed, and it runs on its own port.

Thanks - that makes sense. And goes some way to narrow down the issue.

When visiting the site on port 8888 (or via the tunnel link) the homepage is rendered as expected. However, clicking on any link or going directly to any page only shows the homepage.

E.g., localhost:8888/privacy-policy/ goes to localhost:8888, ie, the homepage

However, localhost:1818/privacy-policy/ shows the privacy policy as intended.

Perhaps the request isn’t making it through from Browser → CLI → Hugo or maybe not making it back?

I’m on the latest Hugo, latest netlify-cli, on latest OSX.

We would need an example project to replicate this issue. I have several Hugo projects myself and the issue doesn’t happen. Maybe you’ve some redirects configured for Netlify?

Still investigating this. I’ve no issue with automated builds on netlify, only using netlify-cli locally. I’ll see if I can get a MWE to share.

1 Like