Vue CLI 3生成项目启动开发服务器时遇异常求助
npm run serve Stuck at "Starting development server..." Hey there, I’ve run into this exact issue a few times when working with Vue CLI 3 on Windows—let’s walk through some practical fixes to get your dev server up and running:
Check for port conflicts
The default 8080 port might be occupied by another app (like a local database, another dev server, or even a background process). Try forcing a different port with:npm run serve -- --port 8081If that works, you can find the process hogging 8080 by running this in PowerShell:
netstat -ano | findstr :8080Then use Task Manager to end the corresponding process (look for the PID from the output).
Wipe dependencies and reinstall
Corrupted node_modules or package-lock.json files are a frequent culprit. Run these commands in your project folder:Remove-Item -Recurse -Force node_modules Remove-Item package-lock.json npm cache clean --force npm installOnce dependencies are reinstalled, try
npm run serveagain.Verify Vue CLI and Node.js compatibility
Vue CLI 3 requires Node.js 8.9 or higher. Check your Node version with:node -vIf your version is too old, upgrade Node.js to a supported LTS release. You can also try re-installing Vue CLI globally to rule out a corrupted installation:
npm uninstall -g @vue/cli npm install -g @vue/cliTemporarily disable firewall/antivirus
Windows Defender or third-party antivirus tools sometimes block the dev server from starting properly. Disable them temporarily and runnpm run serve—if it works, add the Vue CLI service to your security tool’s whitelist.Check custom config for errors
If you added avue.config.jsfile to your project, double-check for typos or misconfigureddevServersettings. You can test with the default config by renamingvue.config.jsto something likevue.config.backup.jsand restarting the server.
Give these steps a try in order—most of the time, the port conflict or corrupted dependencies are the root cause. Let me know if you need further help!
内容的提问来源于stack exchange,提问作者boomboxboy

