失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > pgAdmin启动时浏览器页面一直转圈圈 无法正常打开页面

pgAdmin启动时浏览器页面一直转圈圈 无法正常打开页面

时间:2023-02-21 21:42:55

相关推荐

pgAdmin启动时浏览器页面一直转圈圈 无法正常打开页面

最近新安装了 postgres,同时安装了 pgAdmin 4,但是遇到了无法启动的问题。

问题描述:

打开 pgAdmin 4 ,弹出浏览器页面时一直处于转圈圈加载的页面

使用浏览器开发者工具检查,发现报错信息

Refused to execute script from 'http://127.0.0.1:54943/static/vendor/require/require.min.js?ver=42800' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'http://127.0.0.1:54943/static/js/generated/vendor.main.js?ver=42800' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'http://127.0.0.1:54943/static/js/generated/vendor.others.js?ver=42800' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'http://127.0.0.1:54943/static/js/generated/pgadmin_commons.js?ver=42800' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

解决方案:

从报错信息可以看出,浏览器没有将 require.min.js、vendor.main.js、vendor.others.js、pgadmin_commons.js 这几个文件解释为 JavaScript,所以无法执行这些脚本,他们的响应头里面 Content-Type 是 text/plain。可能是因为 注册表被破坏,把扩展名为 js 的文件类型注册为 ‘text/plain’

方法一:

打开注册表:计算机\HKEY_CLASSES_ROOT\.js\

修改Content Type选项的配置,将text/plain修改为text/javascriptapplication/javascript

方法二:

修改postgres 安装目录/pgAdmin 4/web路径下的config.py文件

在文件末尾添加

import mimetypesmimetypes.add_type('application/javascript', '.js')

方法三:

修改postgres 安装目录/pgAdmin 4/web路径下的config.py文件 第179行

X_CONTENT_TYPE_OPTIONS = “nosniff”修改为X_CONTENT_TYPE_OPTIONS = ""

在方法二、三中,文本编辑器没有用管理员模式运行的话,无法直接保存对config.py文件的修改,可以考虑

先用管理员模式运行文本编辑器,然后在编辑器里面打开该文件将该文件复制到其他路径,修改后再替换回该目录

最后,在右下角托盘右击 pgAdmin 4 图标,shut down server,再重新打开 pgAdmin 4

我的小站、Github、CSDN

如果觉得《pgAdmin启动时浏览器页面一直转圈圈 无法正常打开页面》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。