'Tensorboard page error: MimeType text/plain is not executable
I have the same problem explained in this question: tensorboard shows a blank page and will not load anything. In the console i see the error
Refused to execute script from 'http://localhost:6006/index.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
I have already tried out all solutions exposed on the linked question, and looking around the internet everything brings to the solutions reported there.
I have edited my windows registry as follows and rebooted my pc:

This did not work.
I used the following command to find the mimetypes.py, and got it's output
python -c "import mimetypes; print(mimetypes.__file__)"
Output: C:\Users\MyUser\Anaconda3\lib\mimetypes.py
Then as described in one of the answers i added the following lines to the mimetypes.py file:
if (isinstance(url, str) and url[-3:] == '.js'):
return 'application/javascript', None
And then after saving it i ran the command
python -c "import mimetypes; print(mimetypes.guess_type('index.js'))"
And the output was correct: application/javascript
After all this, starting my tensorboard again and accessing the tensorboard page, the page was blank and the error still there.
I thought of cache errors so i refreshed the page, opened it in incognito, deleted cache...still nothing.
I appriciate any help, thanks
Solution 1:[1]
So apparently this solution was misleading or incomplete. In order to correctly visualize tensorboard and avoid getting the error described in the question, i had to edit both the registry HKEY_CLASSES_ROOT, and HKEY_LOCAL_MACHINE.
So my solution for this problem was:
- Open windows registry editor (windows + r ? regedit)
- Go to HKEY_CLASSES_ROOT ? .js
- Change content type from text/plain to application/javascript
- Then go to HKEY_LOCAL_MACHINE ? SOFTWARE ? Classes ? .js
- Change content type from text/plain to application/javascript
For me it also worked worked by changing the HKEY_CLASSES_ROOT only and leaving the HKEY_LOCAL_MACHINE to text/plain.
Also, there is no need to modify the mimetypes.py file, it can be left as default.
Solution 2:[2]
For Windows:
You can set it via powershell. Run PS as an administrator and execute the follwong commands:
Set-Itemproperty -path 'HKLM:\SOFTWARE\Classes\.js' -Name 'Content Type' -value 'application/javascript'
Set-Itemproperty -path 'HKCR:\.js' -Name 'Content Type' -value 'application/javascript'
If PS throws a "Drive not found" exception, the shortcuts have to be created first.
New-PSDrive -Name HKLM -PSProvider Registry -Root HKEY_LOCAL_MACHINE
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
This should fill an empty tensorboard. If the blank page is still there (e.g. Firefox, Chrome), restart the browser.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alessandro Valentino |
| Solution 2 | FXG |
