65

I installed pgadmin 4 v4.28 and it keeps loading but does not open, I tried opening it as administrator and it still does not open. I had the older version previously but I have deleted PostgreSQL DB and pg admin properly before I install the above version. can you guys help me out on this? the link I have the screenshot of the problem.

enter image description here

Ashraf Yawar
  • 857
  • 1
  • 7
  • 15

6 Answers6

154

Do the following steps to resolve this:

  • Open your registry editor.
  • Change the value of HKEY_CLASSES_ROOT\.js\Content Type from text/plain to text/javascript.
  • Restart the pgadmin server. You can do this by ending the pgadmin background task from the task manager.
areklipno
  • 538
  • 5
  • 11
Harinarayanan K S
  • 1,725
  • 1
  • 7
  • 15
15

UPDATED ANSWER

PGAdmin has been tracking this as bug 5996. In it, they recommend the following solution:

You can add the following lines to the "config_distro.py" and restart the pgAdmin 4 server:

import mimetypes
mimetypes.add_type('text/javascript', '.js')

The above workaround should work for you.

They also mention:

In the next release, we're looking to include that into the code, so users don't have to do it themselves.

But the answer to your question, the config_distro.py can be overwritten in the subsequent upgrades.

pgAdmin does provide another option to set the settings in the config_system.py file which is intended for system administrator to include settings and which is outside of the pgAdmin installation. Please refer https://www.pgadmin.org/docs/pgadmin4/4.28/config_py.html for more details.


PREVIOUS ANSWER

Another answer had comments asking what caused this/how the author figured it out.

For posterity, this is documented in the FAQ:

When I launch pgAdmin 4 v4.28 or later on Windows, the loading page never closes. Why?

pgAdmin 4 v4.28 includes additional security features, one of which is intended to prevent security issues caused by Content Sniffing.

Unfortunately some Windows systems are misconfigured such that this causes Javascripts used by pgAdmin to fail to load. Opening the developer tools on your browser will show an error similar to this:

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

This will occur when the value of the registry key at HKEY_CLASSES_ROOT\.js\Content Type is set to text/plain. To resolve the issue, use the Registry Editor and reset the value of HKEY_CLASSES_ROOT\.js\Content Type to:

text/javascript

Finally, restart the pgAdmin server.

Interestingly enough, GoLang, TensorBoard, Django, and many others have had issues filed regarding this same problem. Browsers are refusing to load content because the browser thinks it is being transferred as 'text/plain', based on the registry configuration.

Ronnie
  • 992
  • 1
  • 9
  • 25
Lynn Crumbling
  • 12,985
  • 8
  • 57
  • 95
  • For some reason this FAQ is now absent from the FAQ page linked. – Gabriel Magana Dec 22 '20 at 17:54
  • @GabrielMagana Well, that is fascinating. I wonder if they're going to remove the added safety that they introduced in 4.28. It caused the product to be _effectively_ broken out-of-the-box, so I wouldn't be surprised if they reversed their decision. – Lynn Crumbling Dec 22 '20 at 19:07
  • 2
    @GabrielMagana Just updated this answer. They intend to have 4.29 to work correctly without needing to modify the registry, by way of including additional lines in `config_distro.py`. – Lynn Crumbling Dec 22 '20 at 19:19
  • 1
    Hi @LynnCrumbling, thanks for your answer! After checking the documentation on https://www.pgadmin.org/docs/pgadmin4/4.28/config_py.html think the best file to use would be `config_local.py` as it won't be overwritten. I've tested it after coming across this issue and it works like a charm. – Wes Jan 20 '21 at 11:11
  • you know an app is coded well when you have to recode it to run it – Krusty the Clown May 14 '22 at 21:18
4

Edited on 25 May 2022 (New Link for pgadmin4 download)

You all have great answers...but then on the experience i just had, the simplest way, which worked for me right away is to install the new version of pgadmin4 without necessarily uninstall the existing one.

That is what i did and i was able to still see all my databases and tables unchanged and untempered.

Just run the installation and you are good to go

vially
  • 187
  • 1
  • 10
  • 2
    For future users, you can safely uninstall the existing one. Just go to add and remove, click on Postgres, then click on uninstall individual component and remove the existing one if you had installed it already. – Lynob Jul 13 '23 at 17:05
  • Same, bundled one didn't work, the one from the pgadmin site, although the same version, did. regedit didn't do anything for me. – Spartan Jul 16 '23 at 05:15
1

You can also downgrade your PgAdmin. I didn't want to change anything in registry editor. So I downloaded and installed pgadmin4-3.6. It works fine on Windows 10 (x64).

Joseph Katzman
  • 1,959
  • 6
  • 21
  • 47
  • 1
    You can also upgrade to v4.29, it works. https://www.postgresql.org/ftp/pgadmin/pgadmin4/v4.29/windows/ – rustyx Jan 05 '21 at 13:42
1

I just upgraded PG Admin from v4.28 to V4.29 and it resolved my issue. One can download the latest version from here for Linux, here for Windows and here for Mac.

This is similar to vialy's recomendation. Thanks Vialy's for your input it save my day... :)

LW001
  • 2,452
  • 6
  • 27
  • 36
-1

I had the same issue with pgAdmin 4.28 using Chrome Browser on windows 10. It started working after I switched to Edge Browser.

daniel ye
  • 25
  • 1