Why cannot nitrosonium ion attack aniline in electrophylic aromatic substitution? This is the nitrosonium ion, which is produced by the reaction of $\ce{NaNO2}$ and $\ce{HCl}$:



[Image source: Wikipedia]

And this is the reaction between aniline and nitrosonium:



[Image source: Wikipedia]

Cannot it take place as an EAS, and with substitution at the ortho or para positions? The amino group is a very good activating group for EAS after all.

Update: I forgot to mention that EAS is observed in case $\ce{-NR2}$ is attached to the ring in place of $\ce{-NH2}$.
What actually happens is that the nitrosonium ion always adds faster to the amino nitrogen.  But that reaction is rapidly reversible unless a proton can dissociate from the amino nitrogen to give a stable N-nitroso product.

A primary or secondary amine has the required N-H proton, and in the case of a primary amine the presence of a second N-H proton enables further reaction making a diazonium ion (as shown for aniline by the OP) or even molecuar nitrogen.  But a tertiary amine has no N-H proton for the elimination step.  A tertiary amine then undergoes no net nitrosation reaction at the nitrogen atom, but if it's aromatic then EAS emerges as an alternative.