Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

287
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda