前段时间遇到无法登录账号的问题,写个文档记录一下。
配置代理服务器
新建文本文件,将HTTP_PROXY
HTTPS_PROXY
中的内容更改为代理服务器的URL,并在start
中修改自己的Unity Hub安装路径。
1 | ```lang-powershell |
保存该文本为.bat
文件,以管理员身份打开。(运行该文件之前确保Unity Hub已经关闭,不然无法生效。)
定位问题
要学会善用错误日志文件定义问题,而不是像无头苍蝇一样通过试错寻找解决问题方法。
日志文件位置
用户信息下拉框->故障排除->打开日志文件夹
定位问题
打开修改日期最近的文件,我的是info-log.json
一共由三种类型的消息:info
warn
error
从距离你产生错误最近的一次日志中定位 error
类型的消息,我的是如下错误:
这个错误是因为代理配置不正确导致的,注意HTTP_PROXY
HTTPS_PROXY
中都是http而不是https
1 | {"timestamp":"2023-05-11T13:56:17.797Z","level":"error","moduleName":"BetaBuildConfig","message":"[\n UnexpectedStateError: Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be \"http:\".\n at parseProxyUrl (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\global-agent\\dist\\utilities\\parseProxyUrl.js:24:11)\n at BoundHttpsProxyAgent.getUrlProxy (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\global-agent\\dist\\factories\\createGlobalProxyAgent.js:108:43)\n at BoundHttpsProxyAgent.addRequest (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\global-agent\\dist\\classes\\Agent.js:62:24)\n at new ClientRequest (node:_http_client:305:16)\n at request (node:https:353:10)\n at Object.request (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\global-agent\\dist\\utilities\\bindHttpMethod.js:55:14)\n at RedirectableRequest._performRequest (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\follow-redirects\\index.js:279:24)\n at new RedirectableRequest (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\follow-redirects\\index.js:61:8)\n at Object.request (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\follow-redirects\\index.js:506:14)\n at dispatchHttpRequest (E:\\Unity\\Unity Hub\\resources\\app.asar\\node_modules\\axios\\lib\\adapters\\http.js:262:25) {\n code: 'UNEXPECTED_STATE_ERROR'\n }\n]"} |
这个错误经过排查后发现,因为我浏览器插件开启了代理,桌面端也开启了clash进行代理导致冲突,关掉浏览器插件的代理就能解决问题。
1 | {"timestamp":"2023-05-11T16:08:26.531Z","level":"error","moduleName":"Authentification Service","message":"[ 'Error fetching new access token from Refresh Token: Error: Client network socket disconnected before secure TLS connection was established' ]"} |