Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动报错 Error:listen EACCESS: permission denied 127.0.0.1:50671 #378

Closed
francis707 opened this issue Jul 27, 2019 · 11 comments
Closed

Comments

@francis707
Copy link

francis707 commented Jul 27, 2019

System (Mac, Windows 7/8/10, Linux) / 操作系统

Windows 10 专业版 Build 17763

SwitchHosts! Version / SwitchHosts! 版本

v3.4.0

Description / 描述

启动报错:
Error:listen EACCESS: permission denied 127.0.0.1:50671

QQ截图20190727145612

netstat -ano|findstr 50761 没有进程

点“确定”之后软件正常启动,也能正常使用

How to reproduce / 重现步骤

安装时选为所有用户安装,安装位置:C:\Program Files\switchhosts,弹出UAC提示之后点同意,安装成功,但是启动报错,点“确定”之后软件正常启动,也能正常使用

@francis707
Copy link
Author

选 只为当前用户安装 也是一样的错误

@capricornxl
Copy link

我也碰到这个问题了,跟你截图中一模一样。

@LauWingHung
Copy link

一样,现在还没解决哦

@lzskyline
Copy link

一样

2 similar comments
@yukunshang
Copy link

一样

@cheerfulman
Copy link

一样

@edwinhuish
Copy link

同样的问题,mark 一下

@oldj
Copy link
Owner

oldj commented Feb 27, 2021

这个是 HTTP API 服务,主要是提供给 Alfred 等第三方快捷启动软件用的,v3.5.8 版可以在设置中将这个服务关闭。

见下图:

image

@francis707
Copy link
Author

新版本这个选项默认关闭没问题了

@CongAn
Copy link

CongAn commented Oct 28, 2022

找到原因了!

因为50761是hyper-v的保留端口。

运行以下命令可以查看哪些端口被保留了。

netsh interface ipv4 show excludedportrange protocol=tcp
  1. 解决方案是删除这个保留端口。(不推荐,删掉后鬼知道hyper-v会出什么问题)。
  2. 修改SwitchHosts代码,自行打包。
  3. 直接改打包后的端口号。

参考资料

@CongAn
Copy link

CongAn commented Oct 28, 2022

如何修改 SwitchHosts 客户端的HTTP API的端口号?(Windows & Cmd)

安装nodejs

https://nodejs.org/

进入官网下载并安装nodejs

安装asar解压压缩工具

 npm i @electron/asar -g

速度慢就配置npm淘宝镜像源。

解压SwitchHosts安装目录下的app.asar

asar extract %UserProfile%\AppData\Local\Programs\SwitchHosts\resources\app.asar %UserProfile%\AppData\Local\Programs\SwitchHosts\resources\app

示例是安装到用户目录的SwitchHosts。

替换文件内50761端口

利用编辑器等工具,搜索并替换解压出来的app目录下所有文件中的50761为你想要设置的端口,例如40761

重新打包app.asar

asar pack %UserProfile%\AppData\Local\Programs\SwitchHosts\resources\app %UserProfile%\AppData\Local\Programs\SwitchHosts\resources\app.asar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants