locust icon indicating copy to clipboard operation
locust copied to clipboard

cannot open dashboard and console error shows 'the server responded with a MIME type of "text/plain".'

Open LeiYangGH opened this issue 11 months ago • 7 comments

Prerequisites

Description

i'm newbie and trying the hellow world from doc

PS C:\Users\LeiYang> D:\pv\loc\Scripts\Activate.ps1
(loc) PS C:\Users\LeiYang> locust -V
locust 2.24.0 from d:\pv\loc\lib\site-packages\locust (python 3.8.3)
(loc) PS C:\Users\LeiYang> cd D:\G\lucust-learn
(loc) PS D:\G\lucust-learn> locust -f .\demo.py
[2024-03-13 22:41:04,777] DESKTOP-1SLBP5D/WARNING/locust.main: Python 3.8 support is deprecated and will be removed soon
[2024-03-13 22:41:04,777] DESKTOP-1SLBP5D/INFO/locust.main: Starting web interface at http://localhost:8089 (accepting connections from all network interfaces)
[2024-03-13 22:41:04,816] DESKTOP-1SLBP5D/INFO/locust.main: Starting Locust 2.24.0

then i open above web page using either edge or chrome, both blank page, and console error is

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

Command line

locust -f .\demo.py

Locustfile contents

from locust import HttpUser, task

class HelloWorldUser(HttpUser):
    @task
    def hello_world(self):
        self.client.get("/hello")
        self.client.get("/world")

Python version

3.8

Locust version

2.24.0

Operating system

windows 11

LeiYangGH avatar Mar 13 '24 14:03 LeiYangGH

I encountered the same issue and wanted to share a temporary workaround. By switching to Windows Subsystem for Linux (WSL), I was able to bypass the problem for the time being. Additionally, I discovered that installing an older version of the package resolved the issue on my end. If anyone else is looking for a temporary fix, you might want to try installing version 2.18.4 of Locust using the following command:

pip install locust==2.18.4

I hope this helps others facing the same problem until a permanent solution is found.

Sh1co avatar Mar 13 '24 18:03 Sh1co

I encountered the same issue and wanted to share a temporary workaround. By switching to Windows Subsystem for Linux (WSL), I was able to bypass the problem for the time being. Additionally, I discovered that installing an older version of the package resolved the issue on my end. If anyone else is looking for a temporary fix, you might want to try installing version 2.18.4 of Locust using the following command:

pip install locust==2.18.4

I hope this helps others facing the same problem until a permanent solution is found.

thanks, indeed this version can show the page. though it says Starting web interface at http://0.0.0.0:8089 and i can only access by http://localhost:8089

LeiYangGH avatar Mar 14 '24 06:03 LeiYangGH

@andrewbaldwin44 Can you take a look?

Instead of running an old version of locust as a workaround, you can probably just add --legacy-ui

cyberw avatar Mar 14 '24 07:03 cyberw

@LeiYangGH Could you please share what browser and version you are using?

andrewbaldwin44 avatar Mar 14 '24 08:03 andrewbaldwin44

chrome 122.0.6261.113(32 bit)

edge 123.0.2420.32 stable,beta channel (64 bit)

LeiYangGH avatar Mar 14 '24 13:03 LeiYangGH

@andrewbaldwin44 Can you take a look?

Instead of running an old version of locust as a workaround, you can probably just add --legacy-ui

confirm this is working!

LeiYangGH avatar Mar 14 '24 13:03 LeiYangGH

@LeiYangGH I just got the chance to try this on Windows 11. I have Python 3.12 and I am able to view the dashboard on both Edge and Chrome image

andrewbaldwin44 avatar May 15 '24 16:05 andrewbaldwin44

This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!

github-actions[bot] avatar May 26 '24 01:05 github-actions[bot]