PS C:\Users\LXD\Desktop\my-vue\vue-cms> npm run dev
01.webpack-study@1.0.0 dev C:\Users\LXD\Desktop\my-vue\vue-cms
webpack-dev-server --open --port 3000 --hot
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use 127.0.0.1:3000
at Server.setupListenHandle [as listen2] (net.js:1253:19)
at listenInCluster (net.js:1318:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1297:8)
at process.tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 01.webpack-study@1.0.0 dev: webpack-dev-server --open --port 3000 --hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 01.webpack-study@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LXD\AppData\Roaming\npm-cache_logs\2019-05-23T14_10_58_853Z-debug.log
PS C:\Users\LXD\Desktop\my-vue\vue-cms>
根據錯誤提示,Error: listen EADDRINUSE: address already in use 127.0.0.1:3000,意思是3000端口已經被占用。這時,我尋找的解決方案為:
-
打開cmd
-
運行netstat -ano,找到報錯信息提示的端口號那一行,記住最后那個數字


3.接下來運行tskill “最后那個數字”,所以這里我運行的是tskill 8408
