The image shows a truncated icosahedron. Each edge of each regular pentagon is coloured red while all the remaining edges are coloured yellow. There are 90 edges and 32 faces in total.
To calculate the number of red edges, notice that each vertex is attached to 2 red edges and 1 yellow edge, so the ratio of red edges and yellow edges is 2 to 1. Hence, there are 90 × 1/3 = 30 yellow edges and 60 red edges.
My problem is why I cannot apply the same logic to determine the number of pentagons and hexagons. Precisely, each vertex belongs to 2 hexagons and 1 pentagons, so the ratio of hexagons and pentagons should be 2 to 1. However, the actual ratio is 20:12.
Can anyone help to explain why the way I calculate the number of edges cannot be applied to calculating the number of pentagons and hexagons? Thanks in advance.

For concreteness, say there are $60$ vertices.
If you count the faces around each vertex and add them up, you will count $120$ hexagons and $60$ pentagons, because there's $2$ hexagons and $1$ pentagon around each vertex. This is the $2:1$ ratio you observed.
However, we overcount both types of faces. Each hexagon has $6$ vertices, so there's really only $\frac{120}{6} = 20$ hexagons. Each pentagon has $5$ vertices, so there's really only $\frac{60}{5} = 12$ pentagons.
Overcounting affects the hexagons and pentagons differently, so the final ratio of $20 : 12 = 5 : 3$ is different from the initial ratio of $2 : 1$.