Deleted subdir shows in fs.readdirsync


#1

I am remixing the howdy.ai slack chatbot. I created a subdir within the skills directory but then deleted the file and created it again in a different subdir off ./ but the ./skills/config subdir still is seen when it runs fs.readdirsync which throws a module not found error (since it attempts to require the name). How do I delete the subdir?
Thanks


#2

It’s possible the app hasn’t fully rebuilt in this case, try making a small edit to package.json (like a new line break or something). This should force the project to fully rebuild. You can check the logs to see what’s going on as well.


#3

We don’t currently delete directories when you remove the last file in the directory. The file list shows files, and not folders right now, so this can be confusing. You should be able to remove the directory using fs.unlinkSync.


#4

For those who might have the same problem. fs.readdirsync was still seeing the directory. fs.unlinkSync generated an EISDIR (Error, is Directory) error. fs.rmdir however did the trick.