WebPack
您现在的位置是:博客主页 > Web教程 > WebPack

windows webpack devServer报错 Error: listen address already in use 127.0.0.1:8090

By 点想博主 on WebPack Time 2019-05-09 from:dianthink.com 702人已围观
简介:    如果本地运行多个webpack项目会报错:listen EADDRINUSE: address already in use :::8090; 提示含义:地址端口已经被占用 注:8090指的是前一个项目的地址端口,但后一个项目默认也会用这个,所以就会冲突报错 Administrator@PC-20190222QKVD MINGW64 ~/Desktop

webpack listen EADDRINUSE: address already in use

如果本地运行多个webpack项目会报错:listen EADDRINUSE: address already in use :::8090
提示含义:地址端口已经被占用
注:8090指的是前一个项目的地址端口,但后一个项目默认也会用这个,所以就会冲突报错;

Administrator@PC-20190222QKVD MINGW64 ~/Desktop/webpack-demo

$ npm run dev

> webpack-demo@1.0.0 dev C:UsersAdministratorDesktopwebpack-demo
> webpack-dev-server --mode development

events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: listen EADDRINUSE: address already in use 127.0.0.1:8090
    at Server.setupListenHandle [as _listen2] (net.js:1270:14)
    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! webpack-demo@1.0.0 dev: `webpack-dev-server --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-demo@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:UsersAdministratorAppDataRoamingnpm-cache_logs2019-05-09T06_41_46_304Z-debug.log
Administrator@PC-20190222QKVD MINGW64 ~/Desktop/webpack-demo

webpack devServer

解决方式:

1、关掉前一个项目的浏览器界面,再关掉前一个项目的编辑器环境,重新输入npm run dev即可;
2、如果上一个方法无效,说明端口还在后台运行,可以考虑命令强关,避免端口冲突,相关操作。
a、window + R调出命令框,输入:netstat -ano。

netstat -ano

b、找到8090端口;输入命令后回车。

tskill 6216

c、重新输入npm run dev运行项目即可。

d、上面太麻烦了,ctrl+c 直接退出就行(已经关闭8090端口),从新编译,端口8090就不会在被占用。

相关文章
文章评论

( 0 )