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 mimetypes
mimetypes.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



我的小站GithubCSDN


  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值