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

363
Views
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 answers
Answer question

0

Try this:

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!