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

181
Visualizações
"The "path" argument must be string. Received undefined"how do I resolve this error

In my project that I developed with node js, I get the error "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be string. Received undefined". Can you help me?

some of the codes:

router.post('/test', (req,res) =>{

   const post_image = req.files.post_image.name

   post_image.mv(path.resolve(__dirname, '../public/img/postimages', post_image.name))

   Post.create(req.body)
   console.log(req.files.post_image.name)
   res.redirect("/")
})

I think the error may be caused by the code in third line because when you make it a comment line, the error disappears.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

_dirname or post_image.name must be undefined. Check all the arguments of path.resolve() function are defined and string

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