# Getting error: "Error occurred while trying to proxy: localhost:3000/"

**URL:** https://discourse.roots.io/t/getting-error-error-occurred-while-trying-to-proxy-localhost-3000/25505
**Category:** sage
**Created:** 2023-06-09T13:46:17Z
**Posts:** 35

## Post 1 by @fab01 — 2023-06-09T13:46:17Z

Following advice from this [thread](https://discourse.roots.io/t/error-occurred-while-trying-to-proxy-localhost-3000/25248), I tried multiple versions of Node (16x, 18x) to no avail.

_Bud.config.js_:

```
app
    .setUrl('http://localhost:3000')
    .setProxyUrl('http://example.test')
```

My setup is Windows 10, WSL. Not using Docker/Vagrant or anything like that.

Package.json: “@roots/sage”: “6.12.2”, after downgrading SASS following advice from this [thread](https://discourse.roots.io/t/importerror-could-not-import-sass/25495/2).

Why is [http://localhost:3000](http://localhost:3000) (or [http://example.test](http://example.test)) not working?

---

## Post 2 by @Atari — 2023-06-09T14:07:23Z

what are using for local dev environment, Local WP, valet?

Can you also post entire Package.json

---

## Post 3 by @fab01 — 2023-06-09T14:23:01Z

Yes local WP.

Package.json:

```
{
  "name": "sage",
  "private": true,
  "browserslist": [
    "extends @roots/browserslist-config"
  ],
  "engines": {
    "node": ">=16.0.0"
  },
  "type": "module",
  "scripts": {
    "dev": "bud dev",
    "build": "bud build",
    "translate": "yarn translate:pot && yarn translate:update",
    "translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --include=\"app,resources\"",
    "translate:update": "wp i18n update-po ./resources/lang/sage.pot ./resources/lang/*.po",
    "translate:compile": "yarn translate:mo && yarn translate:js",
    "translate:js": "wp i18n make-json ./resources/lang --pretty-print",
    "translate:mo": "wp i18n make-mo ./resources/lang ./resources/lang"
  },
  "devDependencies": {
    "@roots/bud": "6.12.2",
    "@roots/bud-sass": "^6.12.3",
    "@roots/bud-tailwindcss": "6.12.2",
    "@roots/sage": "6.12.2",
    "sass": "1.62.1"
  },
  "dependencies": {}
}
```

---

## Post 4 by @Atari — 2023-06-09T15:21:27Z

In the past I found issues if the roots packages are not the same version, so try downgrading  
@roots/bud-sass to 6.12.2 to match. Also if you switch to a standard wp theme like twentytwentythree, is [http://example.test](http://example.test) reachable then? Try to eliminate local WP as the issue first.

---

## Post 5 by @fab01 — 2023-06-09T15:49:46Z

Thanks, I downgraded bud-sass to bring it to the same version as bud, bud-tailwindcss and sage by doing `yarn upgrade @roots/bud-sass@6.12.2`

My package.json now:

```
"devDependencies": {
    "@roots/bud": "6.12.2",
    "@roots/bud-sass": "6.12.2",
    "@roots/bud-tailwindcss": "6.12.2",
    "@roots/sage": "6.12.2",
    "sass": "1.62.1"
  },
```

But now yarn dev triggers a fatal error:

 ![Screenshot_1](https://discourse.roots.io/uploads/default/original/2X/2/26cc592d30b74c88fa243dd73ff95b3f39ca5984.png)

I have spent over a full day trying to merely install a new, default Sage project - every single step was a big issue. Am I incredibly unlucky or?

---

## Post 6 by @Log1x — 2023-06-09T15:52:39Z

Your screenshot isn’t running yarn with WSL.

---

## Post 7 by @EHLOVader — 2023-06-09T15:58:16Z

This was only visible in the excerpt shared from the embed on this thread… but there is an invisible character in your TLD just after test

> [@fab01](#):
>
> Following advice from this thread, I tried multiple versions of Node (16x, 18x) to no avail.  
> Bud.config.js:  
> app  
> .setUrl(‘[http://localhost:3000](http://localhost:3000)’)  
> .setProxyUrl('[http://example.test](http://example.test)%27/)
> 
> My setup is Windows 10, WSL. Not using Docker/Vagrant or anything like that.  
> Why is it not working?

You can kinda see it with the extra space, but it is otherwise invisible to the human eye.

EDIT: Oh wait, maybe that isn’t an invisible character, but perhaps formatted fancy quote?  
Might not be the real issue. but caught my eye.

---

## Post 8 by @fab01 — 2023-06-09T17:01:38Z

Yes it’s WSL console, see logo top left:

 ![Screenshot_1](https://discourse.roots.io/uploads/default/original/2X/1/1f4e1bd36bcc95fa66d3ee96ac8cdd6846696374.png)

@EHLOVader nah it’s not present when viewing bud.config.js in Sublime.

---

## Post 9 by @Atari — 2023-06-09T17:12:50Z

upgrade your node version, you see the error , engine node is incompatible with this module.

---

## Post 10 by @Log1x — 2023-06-09T17:13:44Z

[Installing Sage | Sage Docs | Roots](https://roots.io/sage/docs/installation/#getting-started) use Volta to install Node LTS.

---

## Post 11 by @fab01 — 2023-06-09T17:32:50Z

Thanks!

I installed Volta, and then doing `yarn dev` yielded:

> Volta error: Yarn is not available. Use `volta install yarn` to select a default version (see `volta help install` for more info).

So I did `volta install yarn` and then tried `yarn dev` again, which yielded this error:

> Internal Error: sage@workspace:.: This package doesn’t seem to be present in your lockfile; run “yarn install” to update the lockfile

So I did `yarn install` and got this:

 ![Screenshot_1](https://discourse.roots.io/uploads/default/original/2X/e/e0052c323093d7581255aa2bd832d0478ed53a45.png)

Any idea how to fix this?

---

## Post 12 by @Atari — 2023-06-09T18:19:19Z

Not sure, but first thing i would try is:

- deleting the sage node\_modules folder
- run yarn cache clean
- run yarn install
- run yarn build
- run yarn dev

Its may not help but at least the node modules are clean install on new node and yarn version.

---

## Post 13 by @fab01 — 2023-06-09T18:55:33Z

> [@Atari](#):
>
> yarn build

You were right about that: the error featured in my last message is gone after this clean up, thanks!

But the original problem persists. I’m still getting `Error occurred while trying to proxy: localhost:3000/`

---

## Post 14 by @ben — 2023-06-09T19:03:01Z

Are you running Local from WSL?

[https://community.localwp.com/t/local-via-wsl2-gui-is-much-faster-than-windows-10-native/25414](https://community.localwp.com/t/local-via-wsl2-gui-is-much-faster-than-windows-10-native/25414)

---

## Post 15 by @fab01 — 2023-06-09T20:19:04Z

Yes, doing everything from WSL.

---

## Post 16 by @Atari — 2023-06-09T21:50:23Z

can you reach [http://example.test](http://example.test) at least?

---

## Post 17 by @Atari — 2023-06-09T21:55:15Z

check to see if port 3000 in use: Analyze the output: If port 3000 is in use, you will see a line that shows the local address with the port number and the corresponding process ID (PID) on the right side.

```
netstat -ano | findstr :3000
```

---

## Post 18 by @cim — 2023-06-10T10:47:15Z

Maybe try using `.serve('http://0.0.0.0:3000')` in bud.config

---

## Post 19 by @fab01 — 2023-06-10T21:01:08Z

`http://example.test` is worse than `localhost:3000/` as it yields some “This site can’t be reached” error. Like a complete 404.

Can’t do `netstat -ano | findstr :3000` on WSL as `findstr` isn’t available and I can’t see how to install it.

But I tried to change the port from `3000` to `4000` in bud.config (`.setUrl('http://localhost:4000')`) and I’m getting the same result when visiting `localhost:4000/` than with `3000`.

So I guess that’s not the port.

`.serve('http://0.0.0.0:3000')` didn’t help either.

---

## Post 20 by @Atari — 2023-06-10T23:52:13Z

If you cant even reach [http://example.test](http://example.test) then its not bud, its your Local WP. Can you reach other sites on your Local WP?

---

## Post 21 by @fab01 — 2023-06-11T10:46:58Z

Yes the site works fine on my local WP, I access it through `http://127.0.0.1/my-site`.

---

## Post 22 by @ben — 2023-06-11T14:42:13Z

Then that’s the URL you need to be using instead of `example.test`…

---

## Post 23 by @ben — 2023-06-11T14:42:15Z



---

## Post 24 by @fab01 — 2023-06-13T21:13:29Z

I don’t understand. I’m trying to get hot reload and automatic scss recompilation in reaction to changes through `yarn dev`.

URLs like `http://127.0.0.1/my-site` won’t achieve that. I just tried and sure enough it doesn’t react to changes…

---

## Post 25 by @ben — 2023-06-13T22:32:19Z

Doesn’t Local use `.local` for their sites? You mentioned several times in here that you’re using [Local](https://localwp.com/). This is what you’re using for your setup, right?

If your Local site was named `example.local`, you would replace `example.test` with `example.local` in your Bud config.

> <https://github.com/roots/sage/blob/c0d3dd87f7c13ff201c6b9f7730c970dcbba3f08/bud.config.js#L37>

Then when you are running `yarn dev`, you’d visit the dev server at `http://localhost:3000`.

---

## Post 26 by @fab01 — 2023-06-14T10:11:26Z

I apologize. I didn’t know Local ([https://localwp.com/](https://localwp.com/)) until today and I naively thought I was being asked whether my WP site is a regular one running on my local machine.

So actually I am not using Local.

---

## Post 27 by @ben — 2023-06-14T14:47:36Z

The only thing that matters is that your proxy URL in the Bud config needs to be set to the URL that the Bud dev server will proxy. It should be set to the URL to your local development environment.

---

## Post 28 by @fab01 — 2023-06-14T19:34:32Z

This is what I have in `bud.config.js` now:

```
app
    .setUrl('http://localhost:3000')
    .setProxyUrl('http://localhost/my-site')
    .watch(['resources/views', 'app']);
```

Yet when visiting `http://localhost:3000/` I still see the same error:

 ![Screenshot_1](https://discourse.roots.io/uploads/default/original/2X/b/bfaf96d3fd0d3cf1b82c326bdbbfbc85e607cc23.png)

`http://localhost/my-site/` works fine. But no hot reload or anything of course.

So frustrating. Why is it not working?

---

## Post 29 by @ben — 2023-06-14T19:50:14Z

XAMPP sounds frustrating… try using Local or another local development setup that assigns an actual hostname for sites (`example.test`, `example.local`, etc.)

---

## Post 30 by @fab01 — 2023-06-18T18:36:40Z

I am now using Local WP and my site is locally accessible at `http://my-site.local/`.

`Bud.config.js`:

```
app
    .setUrl('http://localhost:3000')
    .setProxyUrl('http://my-site.local/')
    .watch(['resources/views', 'app']);
```

The issue remains the same - when visiting `localhost:3000` I’m still getting:

> Error occurred while trying to proxy: localhost:3000/

Has it even been tested on Windows? I mean, is there any Windows user here for whom it works?

---

## Post 31 by @fab01 — 2023-06-19T13:13:40Z

This thread has been unlisted (invisible to all users except with a direct link).

Why???

---

## Post 32 by @ben — 2023-06-20T18:15:34Z

Can you confirm whether or not you’re running Local from WSL? Earlier in this topic you had confirmed that you were already doing this, even though you were not actually using Local yet

> [@ben](#):
>
> Are you running Local from WSL?
> 
> [https://community.localwp.com/t/local-via-wsl2-gui-is-much-faster-than-windows-10-native/25414](https://community.localwp.com/t/local-via-wsl2-gui-is-much-faster-than-windows-10-native/25414)

---

## Post 33 by @fab01 — 2023-06-21T17:59:07Z

Can’t we use Local installed from Windows using the regular `.exe` install file? Gosh you guys made this maximally difficult from every possible angle lol - never gone through a setup as difficult as this before. I find it kind of extreme.

Anyway before spending time going through that thread in an attempt to install Local from WSL, could you please confirm that this is necessary and that it is likely to result in `localhost:3000` working?

---

## Post 34 by @ben — 2023-06-21T18:15:39Z

What a ridiculous reply :joy: Shit on us, then expect us to spend more time to hand hold you as you learn how to develop on WSL for free

Give it a shot and learn how to troubleshoot and solve problems

---

## Post 35 by @ben — 2023-06-21T18:15:42Z


