Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

367
Vistas
static files are not loading for ejs (Node.js)

my static files are not loading for ejs. I get following error. I have tried in several ways to get loaded the statics but still I'm getting following errors

Refused to apply style from 'http://localhost:8080/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

info-order:63 GET http://localhost:8080/js/order.js net::ERR_ABORTED 404 (Not Found)

info-order:1 Refused to apply style from 'http://localhost:8080/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

my config file has following code..

const express = require("express");
const path = require("path");

/*config view engine*/

let configViewEngine = (app) => {
  app.use(express.static(path.join(__dirname + "./src/public")));

  app.set("viewEngine", "ejs");
  app.set("views", "./src/views");
};
module.exports = configViewEngine;

And I have link the stylesheet as follow.

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

my script tag on ejs as foillow..

<script src="/js/order.js"></script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this:

app.use(express.static(path.join(__dirname, 'src/public')));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda