It worked before when I just did npm install.

Today I encountered the same problem which is “sh: 1: vite: not found” . So I did npm install as before but doing npm run build this time its failing again.

What I did is issue command npm rebuild then after that when I run npm run build its working again.

The output of running the command npm rebuild is: “rebuilt dependencies successfully”