# Localhost Server Is Not Connecting

**URL:** <https://forum.builder.io/t/localhost-server-is-not-connecting/4646>\
**Category:** Technical Questions\
**Tags:** visual-editor, nextjs\
**Created:** [December 13, 2023, 1:46am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646 "2023-12-13T01:46:23Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 13, 2023, 1:46am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/1 "2023-12-13T01:46:23Z")

</div>

When I go to another page on the website does says if want to go to localhost:3000/blog whenever the website loads the page the server disconnects from the server:

---

<div class="post-metadata">

**Author:** ![sheema](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sheema](https://forum.builder.io/u/sheema)\
**Post date:** [December 13, 2023, 8:14am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/2 "2023-12-13T08:14:16Z")

</div>

Hey @xbrandonpowell it looks there is an issue with your integration. Could you share your code from [[…page.tsx]] and your folder structure?

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 13, 2023, 8:17am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/3 "2023-12-13T08:17:37Z")

</div>

**This is all what is inside of this page:** I did not touch this file or change nothing:

```auto
import { builder } from "@builder.io/sdk";
import { RenderBuilderContent } from "../../components/builder";

// Builder Public API Key set in .env file
builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY);

export default async function Page(props) {
  const content = await builder
    // Get the page content from Builder with the specified options
    .get("page", {
      userAttributes: {
        // Use the page path specified in the URL to fetch the content
        urlPath: "/" + (props?.params?.page?.join("/") || ""),
      },
    })
    // Convert the result to a promise
    .toPromise();

  return (
    <>
      {/* Render the Builder page */}
      <RenderBuilderContent content={content} />
    </>
  );
}

```

---

<div class="post-metadata">

**Author:** ![sheema](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sheema](https://forum.builder.io/u/sheema)\
**Post date:** [December 13, 2023, 11:58am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/4 "2023-12-13T11:58:23Z")

</div>

> [@xbrandonpowell](#):
>
> `builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY);`

Are you adding your public API key here?

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 13, 2023, 1:09pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/5 "2023-12-13T13:09:10Z")

</div>

So the code i post say has it

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 13, 2023, 6:33pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/6 "2023-12-13T18:33:51Z")

</div>

First of I have `.env` I have .env file with public API in there so do not understand what you mean if public API is in .env file.

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 14, 2023, 11:11pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/7 "2023-12-14T23:11:58Z")

</div>

Hi @manish-sharma,

I’m encountering a problem where my server disconnects every time I navigate to a different page, and I’m unsure how to address it. @sheema suggested adding the public API Key within my code, but I’ve already done that as per her instructions.

Have you ever faced a situation where the server prevents you from navigating to other pages and simply disconnects from your local host? Any insights would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![sheema](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sheema](https://forum.builder.io/u/sheema)\
**Post date:** [December 15, 2023, 5:58am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/8 "2023-12-15T05:58:38Z")

</div>

Hey @xbrandonpowell could you please share your folder structure with me?

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 15, 2023, 6:33am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/9 "2023-12-15T06:33:37Z")

</div>

![Screenshot 2023-12-15 at 1.33.03 AM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/8/8aefbe8dfbc6e628276d0ccb3c00371c4f1b5ab2.jpeg)

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [December 15, 2023, 2:07pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/10 "2023-12-15T14:07:30Z")

</div>

Hello @xbrandonpowell,

If you are using node v20 then consider using node v18 or node v19 to resolve this issue.

> [@The localhost:3000 server stops upon refreshing a new page in Builder or localhost:3000](https://forum.builder.io/t/the-localhost-3000-server-stops-upon-refreshing-a-new-page-in-builder-or-localhost-3000/4525/16):
>
> Hi @manish-sharma , My package.json: { “name”: “demo-poc-1”, “version”: “0.1.0”, “private”: true, “scripts”: { “dev”: “next dev”, “build”: “next build”, “start”: “next start”, “lint”: “next lint” }, “dependencies”: { “@builder.io/dev-tools”: “^0.2.6”, “@builder.io/react”: “^3.1.1”, “@builder.io/sdk”: “^2.1.1”, “next”: “14.0.3”, “react”: “^18”, “react-dom”: “^18” }, “devDependencies”: { “@types/node”: “^20”, “@types/react”: “^18”, “@types/react-dom”: “^18”, “autoprefixer”:…

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 15, 2023, 10:01pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/11 "2023-12-15T22:01:23Z")

</div>

This outdated:

 ![Screenshot 2023-12-15 at 4.47.29 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/9/9b44ed836f49c9015dd7f1bf23647ccd437a94d7.png)

All up to date, audited 459 packages in 548ms it says

 ![Screenshot 2023-12-15 at 5.00.13 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/d/dff77947dc304217411291a80ab69b56f6056812.png)  
updated to date.

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 17, 2023, 10:32pm UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/12 "2023-12-17T22:32:04Z")

</div>

This is weird @manish-Sharma and @sheema because I have followed everything because with updating every correctly and still does not work.

Still running into this error will push it up to my GitHub:

- [GitHub - brandonpowell/sbr-builder: This is Builder.io theme built with NextJS with be built with Vue eCommerce.](https://github.com/brandonpowell/sbr-builder)

If you all have found what issues, please let me know. Thank you for all your help within the community and this has been a very great experience.

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [December 18, 2023, 5:33am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/13 "2023-12-18T05:33:25Z")

</div>

Hello @xbrandonpowell,

Could you please run the following command from the terminal and let us know the Node.js version you are currently using?

`node -v`

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 18, 2023, 7:48am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/14 "2023-12-18T07:48:43Z")

</div>

v20.9.0 this updated version

---

<div class="post-metadata">

**Author:** ![xbrandonpowell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/xbrandonpowell/32/3146_2.png) [@xbrandonpowell](https://forum.builder.io/u/xbrandonpowell)\
**Post date:** [December 18, 2023, 10:00am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/15 "2023-12-18T10:00:41Z")

</div>

@sheema and @manish-sharma because was always lost and confused [Node.js](https://nodejs.org/en) on how to correctly download different versions if I have v20 go the [nodejs.org](http://nodejs.org) where do I go to down node v18 or node v19 to resolve this issue.

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [December 18, 2023, 10:34am UTC](https://forum.builder.io/t/localhost-server-is-not-connecting/4646/16 "2023-12-18T10:34:16Z")

</div>

Hello @xbrandonpowell,

You can use nvm to install node version 18.

> **[Install Node.js Locally with Node Version Manager (nvm)](https://heynode.com/tutorial/install-nodejs-locally-nvm/)**
>
> By the end of this tutorial, you should be able to install the nvm command and use it to manage different versions of Node.js on a single environment.
