I want to build a vue project.I use npm init vue@latest to init my project.Then I run npm install to install packages.But When I run npm run dev.I met an error.

Then I run npm run vite preview --port 4173.But It shows that I don't have a vite Script.Then I run npm install vite.It does not work.Please help me.Thanks a lot.

this is my package.json
{
"name": "weathercheck",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 4173"
},
"dependencies": {
"vue": "^3.2.38",
"vue-router": "^4.1.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.3",
"vite": "^3.1.3"
}
}