Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

346
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda