13

I installed Vite build tool for Vue and when I ran it (npm run serve), I got an error that generated the following message

"Missing script: "serve"".

After a little research, I learned that my package.json was missing the serve key.

enter image description here

After I added it ("serve": "vite preview") and ran it, I received the following error in the browser

"Cannot GET /"

1 Answer 1

17

vite preview (previously as serve in Vue2's CLI) only checks the static result when your app is already built with npm run build.

To run it locally, use vite instead of vite preview (which is listed as npm run dev in your package.json config).

More info is available on Vite's documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.