运行vscod,启动npm run dev报错,显示8080端口被占用
解决方法:cmd 之后 懂得直接拿代码,不懂的继续看
netstat -aon|findstr "8080"
taskkill /pid 6828 /f
6868 代表占用8080的进程pid号
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle [as _listen2] (net.js:1318:16)
at listenInCluster (net.js:1366:12)
at Server.listen (net.js:1452:7)
at Function.listen (E:\BaiduNetdiskDownload\vue-weibo-master(1)\node_modules\express\lib\application.js:635:24)
at Object.<anonymous> (E:\BaiduNetdiskDownload\vue-weibo-master(1)\build\dev-server.js:125:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
port: 8080
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-weibo@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-weibo@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\风起\AppData\Roaming\npm-cache\_logs\2022-05-29T07_20_30_699Z-debug.log
说明端口8080被占用,取消占用就可以了,比如把你后台开着的idea关掉,没错,就是这么简单。
如果是3000端口被占用
解决方法
解决方法:cmd 之后 懂得直接拿代码,不懂的继续看
netstat -aon|findstr "8080"
taskkill /pid 6828 /f
6868 代表占用8080的进程pid号
① 开始---->运行---->cmd(window+R组合键,输入cmd),确定,调出命令窗口
② 输入命令: netstat -aon|findstr “8080”,这个命令是查看占用8080端口进程,netstat -aon,命令是查看所有进程,我们这里只看占用8080的端口
③ 输入命令: taskkill /pid 12912 /f
注意这里我们是输入12912是对应的我这里的占用的pid
④.杀完了我们可以在调用第一个命令看一下是否杀完了,这样我们的8080 就可以继续用了。