In LotR:The Two Towers, Saruman breeches the wall at Helm's Deep with black powder (aka gun powder). This point always bothered me but I was finally able to reconcile it.
First, there is no reason that black powder would be incompatible with Middle Earth. It is basically a medieval civilization and black powder was known in Europe through most of the middle ages. Early guns go back as far as the 12th century but they were a poor substitute for bows so they didn't make much of an impression. Early guns were basically a pistol barrel on a sick with little range, accuracy, or penetration. An accurate version became common around 1500 but there was still a debate about the effectiveness of guns a century later.If Gandolf knows about black powder then it is no stretch to believe that the other wizards also know of it including Saruman. And the wizards were a secretive lot. They were in Middle Earth to stop the rise of Sauron, not to bring knowledge and they may have known that black powder was a potentially disruptive technology. It's best to keep these things to yourself lest the enemy be the first to benefit from it.