The two commands differ by one letter. Their jobs couldn't be more different.
👉 npm installs packages into your project.
👉 npx downloads a package, runs it, and removes it afterward unless it's already available.
That's why you'll see this:
npx create-vite@latest
instead of:
npm install create-vite
You're only using
create-vite once to generate a project. Keeping it installed afterward serves no purpose.📖 A simple rule works almost every time:
✔️ If your application needs it to run, install it.
✔️ If you only need the tool for a one-time task, run it with npx.
