saleor / saleor-dashboard

A GraphQL-powered, single-page dashboard application for Saleor.
BSD 3-Clause "New" or "Revised" License
833 stars 1.09k forks source link

[Bug]: Run saleor-dashboard at localhost #5015

Closed PhuongT1 closed 1 month ago

PhuongT1 commented 3 months ago

Description of the issue

I cloned source: https://github.com/saleor/saleor-dashboard but when I run code at localhost

Steps to reproduce the problem

I cloned source: https://github.com/saleor/saleor-dashboard but when I run code at localhost

What did you expect to happen?

browser have error: 'Not allowed to load local resource' when I access : http://localhost:9000/ Can you hep me ?

Additional information

No response

Environment

Dashboard version

Cloud11PL commented 3 months ago

Hi,

Do you have a local instance of Saleor running?

If you want to run Saleor locally (Saleor Core + Dashboard) use https://github.com/saleor/saleor-platform

jigs1212 commented 1 month ago

Use the following installation guide to setup saleor platform locally.

  1. Make sure to comment dashboard section inside saleor-platform/docker-compose.yml.
  2. Update/create .env of saleor-dashboard project as below.

API_URL=http://localhost:8000/graphql/
APP_MOUNT_URI=/
# APPS_MARKETPLACE_API_URL=https://apps.saleor.io/api/v2/saleor-apps
LOCALE_CODE="EN"
DEMO_MODE=false

MAILPITURL=xxxx #For playwright

E2E_USER_NAME=xxxx
E2E_USER_PASSWORD=xxxx
E2E_PERMISSIONS_USERS_PASSWORD=xxxx
BASE_URL=http://localhost:9000/```
tjl521 commented 1 month ago

But I need to run the saleor-dashboard project separately, not the saleor-platform project. How can I resolve this issue?

Not allowed to load local resource: file:///D:/test/saleor-dashboard-main/src/index.tsx

oqildev commented 1 month ago

I have also this issue. Not allowed to load local resource: file:///D:/Devsymfony/saleor-dashboard/src/index.tsx I have own server and own api_url. I just want to run dashboard but not working. Dashboard running localhost:9000 but in browser blank screen.

jigs1212 commented 1 month ago

But I need to run the saleor-dashboard project separately, not the saleor-platform project. How can I resolve this issue?

Not allowed to load local resource: file:///D:/test/saleor-dashboard-main/src/index.tsx

You can stop the saleor dashboard from the docker and can run saleor dashboard locally, and update the .env as mentioned above.

jigs1212 commented 1 month ago

I have also this issue. Not allowed to load local resource: file:///D:/Devsymfony/saleor-dashboard/src/index.tsx I have own server and own api_url. I just want to run dashboard but not working. Dashboard running localhost:9000 but in browser blank screen.

Can you please share the errors from the console.

oqildev commented 1 month ago

Screenshot_3 Screenshot_4

tjl521 commented 1 month ago

但我需要单独运行 saleor-dashboard 项目,而不是 saleor-platform 项目。我该如何解决这个问题? Not allowed to load local resource: file:///D:/test/saleor-dashboard-main/src/index.tsx

您可以从 docker 停止 saleor 仪表板并在本地运行 saleor 仪表板,并按照上面提到的方式更新 .env。

I did configure it this way, and the project started without any issues, but when I open it in the browser, this error is thrown, and there is no content on the page.

tjl521 commented 1 month ago

Screenshot_3 Screenshot_4

My error message is the same as this.

PhuongT1 commented 1 month ago

Screenshot_3 Screenshot_4

Hi oqildev, This happens because you're running the Saleor dashboard on Windows; it doesn't occur on a MacBook. To fix this issue, it's very simple: in the vite.config.js file, change entry: path.resolve(__dirname, "src", "index.tsx") ---> entry: "/index.tsx". It will work fine.

Note: I should also note that if you're running the Saleor Backend on localhost with Windows, you'll need to change some configurations to get the Saleor Backend running, as some packages are not supported on the Windows operating system.