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/javascript 或 application/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
我的小站、Github、CSDN
總結
以上是生活随笔為你收集整理的pgAdmin启动时浏览器页面一直转圈圈 无法正常打开页面的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 通过 SSH 连接到 VMware NA
- 下一篇: 记录 McAfee WebAdvisor