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

[Bug] 在Windows11里面无法正常使用chsrc #133

Closed
1 task done
xyx1926885268 opened this issue Dec 7, 2024 · 8 comments
Closed
1 task done

[Bug] 在Windows11里面无法正常使用chsrc #133

xyx1926885268 opened this issue Dec 7, 2024 · 8 comments

Comments

@xyx1926885268
Copy link
Contributor

你操作了什么?

chsrc set msys2或者chsrc set pip

发生了什么?

/bin/bash: ..chsrc_measure_tmp.sh: No such file or directory rm: cannot remove '/tmp/chsrc-measure-downloaded': No such file or directory

本应该怎么样?

我希望chsrc成功帮我换源

chsrc 版本

chsrc: Change Source (GPLv3+) v0.1.9-2024/10/09 by RubyMetric

你使用的是哪个操作系统?

Windows

OS 版本 / OS 发行版

Windows 11 专业工作站版

Log 输出

[chsrc 测速] 测速中

  - 阿里巴巴开源镜像站(公网) ... /bin/bash: ..chsrc_measure_tmp.sh: No such file or directory
rm: cannot remove '/tmp/chsrc-measure-downloaded': No such file or directory

防止重复问题

  • 我已在项目的 GitHub 和 Gitee 两个仓库分别搜索过类似的 issue
@ccmywish
Copy link
Contributor

ccmywish commented Dec 7, 2024

感谢报告。你是否是在 MSYS2 中执行的 chsrc 命令?你汇报的这个问题只出现在 Cygwin 或 MSYS2 环境中,原生 Windows 是没有问题的。我们前段时间修正过一次,我建议你先安装最新版 chsrc

curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-windows.exe -o chsrc.exe

如果最新版还有问题,请继续汇报,感谢

@Yangmoooo
Copy link
Contributor

其实不一定是 MSYS2 导致的,Git for Windows 也存在相同的问题。在 Git for Windows 的 /usr/bin 目录下也有 cygcheck.exe,这是 chsrc 用于判断是否处于 Cygwin 环境的工具,如果将该目录添加到了 Windows 环境变量中,且在 PowerShell 或 CMD(而非 Git Bash)里运行 chsrc 就会出现该问题

@ccmywish
Copy link
Contributor

ccmywish commented Dec 7, 2024

@Yangmoooo

感谢回复 👍

事实上,Git for Windows 就是基于 MSYS2 实现的,可参考:https://www.msys2.org/docs/who-is-using-msys2/

基于 cygcheck 来检测大体上是没有问题的,因为 CygwinMSYS2 都有这个东西,其他环境不可能有这个。

但是你指出的 如果将该目录添加到了 Windows 环境变量中,我觉得点出了问题的关键,可能就是因为这个原因。

因此我认为可以检测 MSYSTEM 这个环境变量,MSYS2 会设置这个。但现在我并不清楚 Cygwin 设置的环境变量是什么

ccmywish added a commit that referenced this issue Dec 7, 2024
@xyx1926885268
Copy link
Contributor Author

可是这是在powershell7里面执行的, @ccmywish “curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-windows.exe -o chsrc.exe“和”scoop install chsrc”都会出现这个情况,但是在MSYS2里面使用没有出现这个情况。Cygwin我没安装。

@xyx1926885268
Copy link
Contributor Author

xyx1926885268 commented Dec 7, 2024

powershell脚本安装方法好像有问题,我根据那个安装方法,无法安装。下面是结果:
image

@Yangmoooo
Copy link
Contributor

@xyx1926885268 正如我所说,请检查你的环境变量中是否存在 cygcheck.exe,即在 PowerShell 7 里输入该命令检查是否有输出。如果有输出,请使用 Get-Command cygcheck 查看该可执行文件的路径,然后在 Windows 环境变量里将该路径删除即可

@xyx1926885268
Copy link
Contributor Author

好像就是 cygcheck.exe 的问题,我删完之后正常了。非常感谢🙏

ccmywish added a commit that referenced this issue Dec 7, 2024
@ccmywish
Copy link
Contributor

ccmywish commented Dec 7, 2024

@xyx1926885268

README 已更新:

"& { $(iwr -useb https://chsrc.run/windows) } -Version pre" | iex

这样即可下载使用最新版 chsrc

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

No branches or pull requests

3 participants