标签:duration 官网 path mamicode ips pat 技术 cal redis
easy-mock本地部署成功后,迫不及待的想看看是否能正常访问,执行命令 npm run dev 启动项目,访问 127.0.0.1:7300 ,结果郁闷的是报错:EADDRNOTAVAIL 0.0.0.0:7300
一开始看到这个报错信息我就懵逼了,按照官网文档上一步一步的部署过来的,按套路来说应该不会出现这种情况啊,理所应当的就是访问的easy-mock的登录页面呀,谁成想出现这个问题。
郁闷了良久,到处找解决方案,最终发现这个报错原因是因为IP问题。
马上查看了easy-mock项目源代码的配置文件 easy-mock\config\default.json 里的host配置值:
{ "port": 7300, "host": "0.0.0.0", "pageSize": 30, "proxy": false, "db": "mongodb://localhost/easy-mock", "unsplashClientId": "", "redis": { "keyPrefix": "[Easy Mock]", "port": 6379, "host": "localhost", "password": "", "db": 0 }, "blackList": { "projects": [], "ips": [] }, "rateLimit": { "max": 1000, "duration": 1000 }, "jwt": { "expire": "14 days", "secret": "shared-secret" }, "upload": { "types": [".jpg", ".jpeg", ".png", ".gif", ".json", ".yml", ".yaml"], "size": 5242880, "dir": "../public/upload", "expire": { "types": [".json", ".yml", ".yaml"], "day": -1 } }, "ldap": { "server": "", "bindDN": "", "password": "", "filter": { "base": "", "attributeName": "" } }, "fe": { "copyright": "", "storageNamespace": "easy-mock_", "timeout": 25000, "publicPath": "/dist/" } }
将上面的host值改为:localhost,然后重新启动服务,再次访问 0.0.0.0:7300 ,成功!
easy-mock本地部署成功,访问报错:EADDRNOTAVAIL 0.0.0.0:7300 解决方案
标签:duration 官网 path mamicode ips pat 技术 cal redis
原文地址:https://www.cnblogs.com/lwjnicole/p/10792515.html