[GH-ISSUE #182] Failed to load module script #135

Closed
opened 2026-02-25 23:33:31 +03:00 by kerem · 5 comments
Owner

Originally created by @captainsikay on GitHub (Sep 26, 2019).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/182

While trying to start the UI with the serve command I get the following error in the files

  • "base.js:1"
  • "home.js:1",
  • "setting.js:1"
  • "dialog.js:1"

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

The login works fine, after that I get a blank page with only the logout button.

I use Windows 10 with latest chrome (also tried latest firefox) and latest version (as of 26th September) of shiori-windows-amd64.exe from the releases page.

Originally created by @captainsikay on GitHub (Sep 26, 2019). Original GitHub issue: https://github.com/go-shiori/shiori/issues/182 While trying to start the UI with the serve command I get the following error in the files - "base.js:1" - "home.js:1", - "setting.js:1" - "dialog.js:1" `Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.` The login works fine, after that I get a blank page with only the logout button. I use Windows 10 with latest chrome (also tried latest firefox) and latest version (as of 26th September) of shiori-windows-amd64.exe from the releases page.
kerem 2026-02-25 23:33:31 +03:00
Author
Owner

@RadhiFadlillah commented on GitHub (Oct 4, 2019):

@captainsikay sorry for late reply.

Unfortunately I can't seem to reproduce it. I've tested it in Firefox 69 in Manjaro and Windows, also in Chrome 77 and Firefox 69 in Windows.

One of possible reason for this issue is the browser did MIME sniffing on its own, which in some case will mark the JS file as plain text. To fix this, I've added X-Content-Type-Options: nosniff header which will prevent the browser setting content type on its own.

If you don'y mind, could you check it out ? Thanks !

<!-- gh-comment-id:538178143 --> @RadhiFadlillah commented on GitHub (Oct 4, 2019): @captainsikay sorry for late reply. Unfortunately I can't seem to reproduce it. I've tested it in Firefox 69 in Manjaro and Windows, also in Chrome 77 and Firefox 69 in Windows. One of possible reason for this issue is the browser did [MIME sniffing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#MIME_sniffing) on its own, which in some case will mark the JS file as plain text. To fix this, I've added [`X-Content-Type-Options: nosniff`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options) header which will prevent the browser setting content type on its own. If you don'y mind, could you check it out ? Thanks !
Author
Owner

@cocoastorm commented on GitHub (Oct 10, 2019):

Hey, I'm getting hit by this too. I believe what's happening on Windows is that the mimeType being returned is plain/text, which prevents scripts from being executed because of the wrong mimeType.

A quick Google search shows another Github repo getting hit by this (back in 2018): https://github.com/labstack/echo/issues/1038#issuecomment-369946800

Especially in their comment it seems that Windows returns plain/text in their testing.

I believe this is where the mimeType is being set

Very odd lol. I'll try to test with a newer version of Golang.

<!-- gh-comment-id:540332473 --> @cocoastorm commented on GitHub (Oct 10, 2019): Hey, I'm getting hit by this too. I believe what's happening on Windows is that the mimeType being returned is `plain/text`, which prevents scripts from being executed because of the wrong mimeType. A quick Google search shows another Github repo getting hit by this (back in 2018): https://github.com/labstack/echo/issues/1038#issuecomment-369946800 Especially in their comment it seems that Windows returns `plain/text` in their testing. I believe this is where the mimeType is being [set](https://github.com/go-shiori/shiori/blob/master/internal/webserver/utils.go#L45) Very odd lol. I'll try to test with a newer version of Golang.
Author
Owner

@lalitkale commented on GitHub (Dec 23, 2019):

I am facing this issue again. I downloaded the binary "shiori-windows-amd64.exe" for v1.5.0 on Windows 10 and just fired "shiori serve" and getting blank page with
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec error in browser console for 'base.js', 'home.js', 'settings.js' and 'dialog.js'.
go version go1.13.5 windows/amd64

<!-- gh-comment-id:568461097 --> @lalitkale commented on GitHub (Dec 23, 2019): I am facing this issue again. I downloaded the binary "shiori-windows-amd64.exe" for v1.5.0 on Windows 10 and just fired "shiori serve" and getting blank page with `Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec` error in browser console for 'base.js', 'home.js', 'settings.js' and 'dialog.js'. go version go1.13.5 windows/amd64
Author
Owner

@sjbr commented on GitHub (Aug 13, 2020):

I have this problem in chrome and firefox on windows

<!-- gh-comment-id:673241136 --> @sjbr commented on GitHub (Aug 13, 2020): I have this problem in chrome and firefox on windows
Author
Owner

@phanirithvij commented on GitHub (Sep 26, 2021):

Still have this problem, when installed from master. Via go get and go install

<!-- gh-comment-id:927318303 --> @phanirithvij commented on GitHub (Sep 26, 2021): Still have this problem, when installed from master. Via `go get` and `go install`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#135
No description provided.