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

160
Views
import error when trying to import express-jwt

Here is the error I'm getting. Please help.

C:\Users\Val\Desktop\merncamp\server\middleware\index.js:1 import expressJwt from "express-jwt";

SyntaxError: The requested module 'file:///C:/Users/Val/Desktop/merncamp/server/node_modules/express-jwt/dist/index.js' does not provide an export named 'default' at Object. (C:\Users\Val\Desktop\merncamp\server\middleware\index.js:1) at Generator.next () at Object. (C:\Users\Val\Desktop\merncamp\server\routes\auth.js:1) at Generator.next () at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

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

0

I don't know the exact context of what you are trying to do, I will however take a shot in the dark.

The error you are seeing implies that you are asking for something that doesn't exist, based on the way you are trying to import express-jwt.

When code modules in javascript are created they can have named exports and a default export.

From your error it looks like you are importing using the following statement

import expressJWT from 'express-jwt'

This is asking for the 'default' export from that module. Looking at the NPM page for the package it looks like expressJWT is a named export. If this is the case, you would need to modify your import statement to the following

import { expressJWT } from 'express-jwt'

I hope this helps. For next time, try adding your code that is causing the error to help others to answer.

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!