Vue.js项目执行npm run server报错missing script: server求助
Hey there, let's fix this issue right away!
The error you're seeing npm ERR! missing script: server is super straightforward — you've used the wrong script name in your command. Take a look at your package.json file's scripts section:
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
Notice there's no server script listed here, but there is a serve one that's meant to start the development server.
The Fix
Instead of running npm run server, use this command in your cmd:
npm run serve
That should fire up your Vue project's development server without any issues.
A quick reminder for future reference: Whenever you hit a "missing script" error with npm, always check the scripts block in your package.json — it lists all the valid commands you can run with npm run.
内容的提问来源于stack exchange,提问作者ffblord

