vue踩坑-Error: listen EADDRNOTAVAIL 192.168.1.122:8081

每天上班,重启电脑,按照下面的步骤,打开vue的项目,开始编写代码,但是,今天一如往常一般操作:
1:cd /项目名称
下面就是运行项目了,cd /项目名称,我的文件放在D盘,所以先进入d盘,再进入项目。
cd ShopApp

5640239-e5829917d43b7a7f
image

2:npm run dev
一切准备就绪,启动项目
npm run dev

但是,却出现了以下的报错,一开始很郁闷,仔细看了一下错误提示,应该是IP地址出错了。

之前为了能在手机上访问vue的项目,找到config文件夹下的index.js文件,打开后,将host的值改为我本地的ip。
如何在手机上查看测试vue-cli构建的项目:https://www.jianshu.com/p/a15be31cab12

5640239-c1015747a2374892.png
图片.png

Error: listen EADDRNOTAVAIL 192.168.1.122:8081
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1334:19)
    at listenInCluster (net.js:1392:12)
    at doListen (net.js:1501:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:678:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! shopapp@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the shopapp@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:\Program Files\nodejs\node_cache\_logs\2018-08-28T03_29_03_820Z-debug.log
5640239-7bf2c18614df5dfb.png
图片.png

解决办法:
因为机器重启,DHCP重新分配了IP。重新配置工程绑定当前分配的IP就可以了,或者修改本机的IP为静态IP,问题就解决了。

1:打开cmd,命令行运行 ipconfig,得到本机的ip地址:


5640239-972dd7aad7a59f89.png
图片.png

2:找到config文件夹下的index.js文件,打开后,将host的值改为我上一步所得到的ipv4即可


5640239-cf9b09e09c70aaa6.png
图片.png

原文作者:祈澈姑娘
技术博客:https://www.jianshu.com/u/05f416aefbe1
90后前端妹子,爱编程,爱运营,爱折腾。
坚持总结工作中遇到的技术问题,坚持记录工作中所所思所见,欢迎大家一起探讨交流。

已标记关键词 清除标记
表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
<div><p>I have a .net core web api project created and deployed it to Azure. When the app starts it is throwing this error? None of the request are being processed.</p> <p>[WRN] Unable to bind to http://localhost:22676 on the IPv6 loopback interface. (de7f78a0) System.AggregateException: One or more errors occurred. (Error -4090 EADDRNOTAVAIL address not available) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4090 EADDRNOTAVAIL address not available at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags) at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address) at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket() at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.b__8_0(Object state) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address) at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start<a href="IHttpApplication%601%20application">TContext</a> ---> (Inner Exception #0) Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4090 EADDRNOTAVAIL address not available at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags) at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address) at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket() at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.b__8_0(Object state)<---</p><p>该提问来源于开源项目:aspnet/KestrelHttpServer</p></div>
©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页
实付 9.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值