You're using fs.readdirSync() but never imported the fs module. Add this at the top: import fs from "fs"; plus your comment says import fc from "fs".