nextcloud28 failed to load module script (Solved)

分享讨论IT相关的内容
回复
头像
BobMaster
锋芒初露
锋芒初露
帖子: 1207
注册时间: 2020年 12月 7日 08:05
来自: 神秘的东方
我的状态: 🎯
为圈友点赞: 349 次
被赞次数: 189 次
联系:

nextcloud28 failed to load module script (Solved)

帖子 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
BobMaster 的这篇帖子被以下圈友点了赞:
genivel
人生如音乐,欢乐且自由
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 14 访客