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

250
Views
Error [ERR_HTTP_HEADERS_SENT]: no se pueden establecer encabezados después de enviarlos al cliente en la CLI

He estado escribiendo un código para una lista de tareas, este es el archivo de nodo:

 const express=require("express"); const bodyParser=require("body-parser"); const ejs = require('ejs'); const app=express(); app.set("view engine", 'ejs'); app.get("/", function(req, res){ var today=new Date(); var currentDay=today.getDay(); var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; var day="" if (currentDay===6||currentDay===0){ res.write("Yay today is a weekend") day=days[currentDay]; console.log(day) res.render("list",{kindaDay:day}); res.send(); } else{ res.write("boo this is a weekday") day=days[currentDay]; res.render("list",{kindaDay:day}); res.send(); } }) app.listen(3000, function(){ console.log("connected to port 3000"); })

Y este es el archivo EJS

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href=""> </head> <body> <h1>It is an amazing day as it is an <%=kindaDay%> </h1> <script src="" async defer></script> </body> </html>

El archivo da un error que dice "Error [ERR_HTTP_HEADERS_SENT]: No se pueden establecer encabezados después de enviarlos al cliente". ¿Cuál podría ser el error?

about 4 years ago · Juan Pablo Isaza
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!