Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Refused to apply style from 'xxx/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type

I am new to Google App Engine and I'm trying to get the project I've been running locally hosted there.

My index.html file shows up, but it is not applying the CSS to it. I'm not exactly sure what a MIME type is, and I'm not exactly sure where in my code it's trying to get this from. I just assumed that it would just load the tag that I have in my HTML content and apply it like how it did while using browsersync. File index.html is loaded via:

app.get('/', (req, res) => {
  res.sendFile(path.join(__dirname, '/index.html'));
});

CSS being loaded in file index.html:

<link rel="stylesheet" type="text/css" href="style.css">
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Permanent fix:

File server.js

app.use(express.static('./public'));

And move all your static resources to a public directory in your project. Then your HTML content is valid.

Source

about 4 years ago · Juan Pablo Isaza Report

0

When you're returning the stylesheet from the server, you should set the content-type attribute for the header to text/css i.e. you should have something like

<link href="style.css" rel="stylesheet" />

app.get('/style', (req, res) => {
    res.setHeader('Content-Type', 'text/css');
    res.sendFile(path.join(__dirname, '/style.css'));
});

app.get('/', (req, res) => {
    res.setHeader('Content-Type', 'text/html');
    res.sendFile(path.join(__dirname, '/index.html'));
});


about 4 years ago · Juan Pablo Isaza Report

0

The issue could probably be with the CSS library starting with comments.

In development, if the style sheet is started with some comments, it could be seen as something different from CSS.

Removing the library and putting it into a vendor file, may solve the issue.

Another possibility for Node.js applications is that you should check your configuration.

Example:

app.use(express.static(__dirname + ‘/public’));

Notice that /public does not have a forward slash at the end, so you will need to include it in your href option of your HTML:

Example:

href=”/css/style.css”>

If you did include a forward slash /public/, then you can just do href=”css/style.css”>.

Be sure that the CSS name is style.css without the second "s" at the end. That could also cause the issue.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!