No free/open-source license may disallow commercial use.
The whole purpose of the Free and Open movements is an altruistic one: if you're making your project free and open, you're gifting it to the public at large, under certain terms (which often boil down to "attribute it back to me"). See the Open Source Definition for some explanation of what these movements are trying to achieve, and why no open-source license can disallow commercial use.
One of the central tenets of these movements is that they do not discriminate: your software becomes something that anyone can use, no matter for what purpose they're using it. Point 6 of the Definition sums it up: "No Discrimination Against Fields of Endeavor". You can't say "open-source but non-commercial", because that does exactly that - discriminates against those who wish to use your software for commercial purposes.
What? But it's mine! Surely I can restrict it!
Sure, you can, if you really want to. What you can't do is restrict commercial use and still call your project open-source. As the copyright holder, it's your prerogative to restrict any kind of use of your software, if you wish to, or to keep it to yourself and not allow anyone else to use it at all. If that's what you want to do, that's your right - but the Open Source movement is about sharing gratuitously, not about excessive restriction; you can place restrictions on your own software, but you can't truthfully claim that it's still truly open-source.
But I found X project that restricts commercial use and they call it open-source!
They're lying to you - though whether that's intentional or not, who knows. Sorry. See above. Refer the maintainers of that project here, if you're not sure whether or not they know the difference.
A number of people use "open source" to mean "source-available", thinking the two are synonymous. For many purposes, they are, but a strict interpretation of the term "open source", as coined by the open-source movement, includes the philosophy of not placing restrictions on the use of the licensed software.
So what can I do?
You can dual-license your software. This is a very common model: you offer your software, open-source, under the terms of a copyleft license. Anyone can use this, for any purpose, but since a copyleft license requires that the project developed around your software be distributed under the same (or similar) license, using a copyleft-licensed project for commercial purposes is often more difficult than with a permissive license.
At the same time, you advertise that you also offer your project under a closed-source license that offers the licensee more freedom (and the ability to not have to redistribute their software as open-source too). The catch? You sell these licenses, rather than giving them away. If someone wants to pay you to be able to use your software for commercial purposes, you sell them one of these licenses, and you both win.
If you just want to disallow any commercial activity using your software, no matter whether they're paying or not, you have two options:
- Use a license that disallows commercial activity, and accept that you can't truthfully call your project open-source or free software.
- Use a copyleft license (such as the GNU GPL) and accept that although it'll be more difficult to use your software for commercial purposes, it may still happen.