The documentation for fs.rmdir is very short and doesn\'t explain the behavior of rmdir when the directory is not empty.
Q: What happens if I try to use
This worked for me
fs.rmdirSync(folderpath, {recursive: true});