Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

730
Vistas
TypeError: callback is not a function when removing directory

When I try to remove an existing directory (and its files inside) with fs.rm('./temp/', { recursive: true, force: true }); it succesfully remove it but it throws this error:

node:internal/fs/rimraf:60
    callback(err);
    ^

TypeError: callback is not a function
    at CB (node:internal/fs/rimraf:60:5)
    at FSReqCallback.oncomplete (node:fs:188:23)

I have Node v16.13.2 installed. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

due to the node.js fs documentation https://nodejs.org/api/fs.html#fsrmpath-options-callback

you must pass a callback function fs.rm(path[, options], callback)

so your code will look like this:

fs.rm('./temp/', { recursive: true, force: true }, (error) => {
    //you can handle the error here
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda