Yarn dev return error

Hi guys
I am new in sage. I ran yarn dev with below bud.config:

/**
 * @typedef {import('@roots/bud').Bud} bud
 *
 * @param {bud} app
 */
module.exports = async (app) => {
  app
    /**
     * Application entrypoints
     *
     * Paths are relative to your resources directory
     */
    .entry({
      app: ['@scripts/app', '@styles/app'],
      editor: ['@scripts/editor', '@styles/editor'],
    })

    /**
     * These files should be processed as part of the build
     * even if they are not explicitly imported in application assets.
     */
    .assets('images')

    /**
     * These files will trigger a full page reload
     * when modified.
     */
    .watch('resources/views/**/*', 'app/**/*')

    /**
     * Target URL to be proxied by the dev server.
     *
     * This should be the URL you use to visit your local development server.
     */
    .proxy('http://localhost/sage')

    /**
     * Development URL to be used in the browser.
     */
    .serve('http://localhost:3000/sage')

    /**
     * Relative path to the public directory.
     */
    .setPublicPath('/app/themes/sage/public/');
};

but I got “Error occurred while trying to proxy: localhost:3000/sage/” in localhost:3000/sage url and "[proxy] › :heavy_multiplication_x: [HPM] Error occurred while proxying request localhost:3000/sage/ to http://localhost/sage " in terminal

I use wampserver

Howdy!

I’d highly recommend refining your development environment so that you’re serving your site from an individual host, like example.test

1 Like

Thanks a lot @ben
I have create a VirtualHost named “sage.test” so I have:

.proxy(‘http://sage.test’)
.serve(‘http://localhost:3000/sage’)

but I got same error

I have the same problem

open browser error: Error occurred while trying to proxy: localhost:3000/
222

my code: bud.config.js

/**
 * @typedef {import('@roots/bud').Bud} bud
 *
 * @param {bud} app
 */
module.exports = async (app) => {
  app
    /**
     * Application entrypoints
     *
     * Paths are relative to your resources directory
     */
    .entry("app", ["@scripts/app", "@styles/app"])

    /**
     * These files should be processed as part of the build
     * even if they are not explicitly imported in application assets.
     */
    .assets([
      { from: app.path("@src/images"), to: app.path("@dist/images/@file") },
    ])

    /**
     * These files will trigger a full page reload
     * when modified.
     */
    .watch("tailwind.config.js", "resources/views/**/*", "app/**/*")

    /**
     * Target URL to be proxied by the dev server.
     *
     * This should be the URL you use to visit your local development server.
     */
    .proxy("http://moomee.test")

    /**
     * Development URL to be used in the browser.
     */
    .serve("http://localhost:3000")

    /**
     * Relative path to the public directory.
     */
    .setPublicPath("/wp-content/themes/mootoon/public/");
};

I have been stuck with this problem for days, searched all threads, and couldn’t find a solution.

Can you connect to http://moomee.test/ in your browser? Your error shows ECONNREFUSED which suggests it’s having trouble connecting. What environment are you running this command in?

2 Likes

Yes, I can connect to http://moomee.test/ success.

project run web server in Laragon and Linux WSL2 on Windows run bud.js

Hi, are there any solutions?

I’m not sure what the issue is here, based on present info. I can say that users are successfully using bud with WSL2, and this is likely not a problem with bud but most likely a dev server configuration issue.

I’d think the next step is to make sure that your server is issuing a normal response (code 200). Others have reported similar issues and it has been the result of the server issuing a redirection or failure status. bud is not set up to follow proxy redirections, by default.

Under the network panel in devtools, what are the response headers being issued by the server? That’s the next thing I would check.

Hey @Hossein_khan

I’m experiencing the same issue with local setup using laragon and WSL2 in windows
Did you fix this problem?

Please use your existing topic instead of this one that is a year old