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

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

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 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!