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

477
Views
Why am I getting an error saying that expressJwt is not a function?

So I am trying to implement this middleware in my code.

const expressJwt = require("express-jwt");

    function authJwt() {
      const secret = process.env.secret;
      return console.log(
        expressJwt({
          secret,
          algorithms: ["HS256"],
        })
      );
    }
    
    module.exports = authJwt;

But I am getting the following error - expressJwt is not a function

I have done npm install express-jwt. I do not understand why this is giving me this error.

Error

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try this..

const { expressjwt: expressJwt } = require('express-jwt');
about 4 years ago · Juan Pablo Isaza Report

0

Your import statement might be formatted wrong. Try...

const { expressjwt: jwt } = require("express-jwt");

See: https://www.npmjs.com/package/express-jwt for more information.


UPDATE: anybody scrolling straight to this, see this comment for solvency => Why am I getting an error saying that expressJwt is not a function?

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!