Had the same issue:
Typed as instructed,
cd vite-project
npm install
npm run dev
On package.json, I had the following:
"vite": "^6.0.1"
but the message said
sh: vite: command not found
Installed the dependencies again by doing
npm install
and seems to work.