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

288
Vistas
error 'require is not a function' when exported and required correctly

I am not exactly a node newbie, but this issue has me stumped. Basically, this is an issue for me, nobody else on my team. After the usual npm install etc, calling a function returns require(...) is not a function. I have exported it properly and am passing in the parameter properly and again, this seems to be limited to me. Any suggestions?

Function file

const logger = require('../util/logger')('someParam');
                                       ^Fails here

Logger file:

function logger(param) {
  console.log('this is the param: ', param);
}

module.exports = logger;

I have tried this in node 4.4.2, 6.10.2 and 7.7.1

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I forgot about this question. After some time, I decided to reclone the repo and npm install again, and the issue did not present itself. I have no idea what caused the issue as my code was the same as a fresh clone. One of those things.

over 4 years ago · Santiago Trujillo 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