分页: 1 / 1

nextcloud28 failed to load module script (Solved)

发表于 : 2023年 12月 13日 15:00
BobMaster
将nextcloud升级到最新的28版本后,各种apps打开都是空白页,控制台显示类似如下的错误。
firefox:
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.
chrome:
expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream"

翻了一下nextcloud28的更新日志,有提到用vuejs重写了很多东西,而报错的资源文件是mjs。打开nginx.conf和相应目录下的mime.types,发现默认文件类型为application/octet-stream

代码: 全选

http {
    include       mime.types;
    default_type  application/octet-stream;
}
而mime.types文件内默认是没有mjs的,我们将其添加到application/javascript栏目即可。

代码: 全选

types {
-     application/javascript                           js;
+    application/javascript                           js mjs;
}
添加后重载nginx解决了上述问题,这里特此记录一下。

其实官方文档七个月前就已经添加了,但谁会注意到呢?除非重装~~~
https://github.com/nextcloud/documentat ... a501eb8f01