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

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

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