Content length mismatch for modules when accessing dev server through android emulator #20570
Replies: 12 comments 2 replies
-
I've checked if I can reproduce it but it worked fine on my machine. I guess you have to debug the reason on your own. |
Beta Was this translation helpful? Give feedback.
-
@sapphi-red What setup did you use? It's been successfully repro'd on a few machines so it's odd that it didn't on yours |
Beta Was this translation helpful? Give feedback.
-
I used Android emulator 35.4.9-13025442 + Pixel 9 API 35 on Windows 11. |
Beta Was this translation helpful? Give feedback.
-
It looks like you are accessing the Vite dev server via 10.0.0.0/n. Maybe there's a proxy or something similar modifying your content? |
Beta Was this translation helpful? Give feedback.
-
Could I trouble you to also test on a lower version of the android API? specifically 31 There isn't any proxy setup, it's how the emulator is able to get to localhost when it runs on the same machine |
Beta Was this translation helpful? Give feedback.
-
I've tested with Pixel 5 + API 31 now, but it doesn't reproduce. |
Beta Was this translation helpful? Give feedback.
-
Drats, thank you for testing again for me. Hopefully someone else will be able to repro it with more knowledge about the bundling and serving side of the vite dev server |
Beta Was this translation helpful? Give feedback.
-
did you make any progress? i encountered same error with nuxt 3 developtment server. it's not happens with vue 3 somehow. |
Beta Was this translation helpful? Give feedback.
-
Haven't been able to make any progress, other than narrowing down the issue to be with Dell-based computers. I was able to test this on a few different makes and models and they worked - except Dells |
Beta Was this translation helpful? Give feedback.
-
exact same problem using windows 11 , nuxt 4 . but the app runs fine on physical android device, anyone found a fix for this ? |
Beta Was this translation helpful? Give feedback.
-
can you open the dev server in chrome which is in emulator device ? , its seems like cors and nitro issue with nuxt |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
As part of upgrading one of our sites to use Vite, we have ran into an issue when accessing the dev server on various android emulators.
The issue seems to maybe stem from the web sockets / hot module reload, but unsure as each "fix" we have attempted hasn't proven fruitful and the access via the emulator remains flaky. When it fails the tab remains a white screen.
Below is the screenshot of the exact error when accessing the chrome inspector for emulators via

chrome://inspect/#devices
(to see the network tab)The content that is required to be transferred appears to be larger than the expected content-length from the vite dev server.
Removing the sass aspect of the App.scss did not resolve the issue, only moved it to another module (e.g., MUI).
I have attached a repo with a minimal reproduction and response content. The only other issue that seems related is this closed issue.
Reproduction
https://github.com/ajscott-hcs/vite-dev-android
Steps to reproduce
Steps are wtihin the top level readme of the repro repo, but will add here for brevity.
Ensure you also have an android emulator running, this currently has been tested against the following emulators:
System Info
Used Package Manager
npm
Logs
Reponse content
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [],
"cookies": [],
"content": {
"size": 3774708,
"mimeType": "text/css",
"compression": 10815
},
"redirectURL": "",
"headersSize": 237,
"bodySize": 3763893,
"_transferSize": 3764130,
"_error": "net::ERR_CONTENT_LENGTH_MISMATCH"
},
Validations
Beta Was this translation helpful? Give feedback.
All reactions