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

374
Views
los archivos estáticos no se cargan para ejs (Node.js)

mis archivos estáticos no se cargan para ejs. Recibo el siguiente error. He intentado de varias maneras cargar las estáticas, pero aún recibo los siguientes errores.

 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.

mi archivo de configuración tiene el siguiente código ...

 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;

Y he vinculado la hoja de estilo de la siguiente manera.

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

mi etiqueta de secuencia de comandos en ejs como folow ..

 <script src="/js/order.js"></script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Prueba esto:

 app.use(express.static(path.join(__dirname, 'src/public')));
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!