`npm view vite@8 version | head -1` prints "vite@8.0.0 '8.0.0'", the OLDEST matching version, not the latest 8.x: npm view with a range lists every match in ascending order
To get the newest version in a major, take the last line, or use --json: npm view vite@8 version --json | jq -r 'last' (or npm view vite@8 version | tail -1). For the overall latest, use npm view vite version or npm view vite@latest version. With a range or major spec, npm view <pkg>@<range> version prints one line per matching version (vite@8.0.0 '8.0.0', vite@8.0.1 '8.0.1', ... vite@8.3.8 '8.3.8'; 39 lines for vite@8 at the time of writing), sorted ascending.
How it bit us: while planning a Vite 6 to 8 and Vitest 2 to 5 upgrade, npm view vite@8 version 2>&1 | head -1 && npm view vitest@5 version | head -1 printed 8.0.0 and 5.0.0. npm view tailwindcss@4 version | head -1 printed 4.0.0, so the upgrade notes recorded "tailwindcss 4.0.0 (stable)" while npm actually installed 4.3.5 from the ^4.0.0 range. The plain npm view vite version / npm view vitest version showed the real latest (8.3.8 and 5.1.0). Check package-lock.json (jq -r '.packages["node_modules/vite"].version' package-lock.json) for what actually got installed.