. Advertisement .
..3..
. Advertisement .
..4..
MIME-type is a method to define the type of content. The “MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled” error is a common issue many users face worldwide. You can easily fix this error by following some manual steps or using the information provided in this article.
How To Fix The Error “MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled”?
You can have trouble with the following error.
Refused to apply style from ‘http://localhost:3000/assets/styles/my-custom-style.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled
To fix this error, delete the rel=”stylesheet” attribute from the link tag. This is an example of a link tag: <link href=”my-custom.css” rel=”stylesheet”> #. I’m having a problem with this error. However, if I remove the rel=”stylesheet” tag. My problem was then resolved <link href=”starter-template.css”> # Working fine. My problem has now been resolved.
Ensure your file name and the name you’re utilizing in the link tag are both the same to fix this error. For instance, the name of my CSS file is style.css. Then I have a link tag that looks like this: <link rel=”stylesheet” href=”style.css”> #Right. But if you utilize styles.css, you’ll get the following error: <link rel=”stylesheet” href=”styles.css”> #Wrong. It’ll give you an issue. Your problem should now be resolved.
Option 1: Examine file name
Ensure your file name and the name you’re utilizing in the link tag are both the same to fix this error. For instance, the name of my CSS file is style.css. Then I have a link tag that looks like this:
<link rel="stylesheet" href="style.css"> #Right
But if you utilize styles.css, you’ll get the following error:
<link rel="stylesheet" href="styles.css"> #Wrong It Will Give Error
This will fix your problem.
Option 2: Delete rel=”stylesheet”
To fix this error, delete the rel=”stylesheet” attribute from the link tag. This is an example of a link tag:
<link href="my-custom.css" rel="stylesheet"> # I am facing Error <link href="my-custom.css" rel="stylesheet"> # I am facing Error
However, if I remove the rel=”stylesheet” tag. My problem was then resolved:
<link href="starter-template.css"> # Working fine
My problem has now been resolved.
Option 3: For Nodejs
If you’re using Nodejs, you should double-check your settings. If your directory name is similar to this:
app.use(express.static(__dirname + '/public'));
Then, you have to use:
<link href="/css/style.css">
If you have a dirname that is similar to this.
app.use(express.static(__dirname + '/public/'));
Then you’ll most likely have to use.
<link href="css/style.css">
Your issue has now been fixed.
Conclusion
We hope you enjoyed our blog about fixing the error “MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled”. If you have any other questions or concerns about fixing this issue, please leave a comment below. Thank you for reading; we are always excited when one of our posts can provide useful information on a topic like this!
Leave a comment