Replace deprecated path.exists with fs.exists.