Why 1.0.0-beta.11 comes after 1.0.0-beta.2
Version numbers look like decimals, which is the root of most mistakes with them. 1.10.0 is not "one point one zero": it is major 1, minor 10, patch 0. Compared part by part, minor 10 is bigger than minor 9, so 1.10.0 comes after 1.9.0. Sort the same strings as text and 1.10.0 comes first, because the character 1 sorts before 9. Every tool that compares versions has to split them into numbers first, and this one does.
Pre-releases have their own rule, and the semver spec gives a worked list to test it with: 1.0.0-alpha, then 1.0.0-alpha.1, 1.0.0-alpha.beta, 1.0.0-beta, 1.0.0-beta.2, 1.0.0-beta.11, 1.0.0-rc.1, and finally 1.0.0. The label is split at each dot and compared piece by piece. Pieces that are all digits compare as numbers, so beta.11 is after beta.2, not before it. Pieces with letters compare as text, so alpha is before beta and beta is before rc. A number always comes before a word, which puts alpha.1 before alpha.beta. When one label runs out first, the shorter one is lower, so alpha comes before alpha.1. And any pre-release is lower than the release itself. Put those rules together and the spec’s list comes out in exactly that order, as the tests behind this page check.
npm ranges are shorthand for pairs of comparisons. Type ^1.4.0 and "Range means" shows >=1.4.0 <2.0.0-0: at least 1.4.0, and below 2.0.0 and every pre-release of it. ~1.4.0 becomes >=1.4.0 <1.5.0-0. A hyphen range, 1.2.3 - 2.3.4, becomes >=1.2.3 <=2.3.4, and 1.x becomes >=1.0.0 <2.0.0-0. Below 1.0.0 the caret narrows on purpose: ^0.4.0 means >=0.4.0 <0.5.0-0, and ^0.0.3 means only 0.0.3, because the spec treats everything before 1.0.0 as unstable.
The rule that catches people is the one for pre-releases. Take 1.4.2-beta.3 and the range ^1.4.0. By the comparisons alone it fits: it is above 1.4.0 and below 2.0.0. But npm says No, because a pre-release may only match a range that mentions a pre-release with the same three numbers. The idea is that installing ^1.4.0 should never hand you an unfinished beta. Change the range to ^1.4.2-beta.0 and it matches, and so would 1.4.2-beta.7, but 1.4.3-beta.1 still would not. The tool explains this in a note when it is the only reason for a No.
Bumping follows npm version. From 1.4.2-beta.3, the next patch is 1.4.2, because finishing a pre-release is a patch. The next minor is 1.5.0 and the next major 2.0.0. The next pre-release with the name beta is 1.4.2-beta.4. Pre-minor with the name rc gives 1.5.0-rc.0. Build metadata is dropped by every bump, since it describes one particular build.
Some limits. The tool reads strict semver with a leading v or = allowed. It does not do npm’s loose mode, which accepts things like 1.2.3beta. Ranges are checked as npm checks them by default; the note shows the --include-prerelease answer where it differs, but there is no switch for it. Numbers above 9,007,199,254,740,991 in a version are refused, as npm refuses them.