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

& "$env:RBENV_ROOT\rbenv\bin\rbenv.ps1" init 不能正确执行 #7

Closed
guojhq opened this issue Jan 11, 2023 · 17 comments
Closed

& "$env:RBENV_ROOT\rbenv\bin\rbenv.ps1" init 不能正确执行 #7

guojhq opened this issue Jan 11, 2023 · 17 comments
Assignees

Comments

@guojhq
Copy link

guojhq commented Jan 11, 2023

image
image

@ccmywish
Copy link
Collaborator

ccmywish commented Jan 11, 2023

你好,这个下载链接是正确的,没有错。我刚复制了这个链接到浏览器里,也可以正确下载。

不太清楚为什么那边返回了308,你可以重新打开终端让它再试一次。

如果还不行的话,试试 curl 一下这个链接,看能否正确下载。

C:\Ruby-on-Windows 目录里只存在一个 rbenv 目录,就相当于reset了。

@ccmywish
Copy link
Collaborator

哦,我才看到,原链接你这边也下载不了。我这边来排查下。

@ccmywish
Copy link
Collaborator

ccmywish commented Jan 11, 2023

image

@guojhq 我这边没啥问题。可能你需要检查下你那边的网络问题,如还是无法工作,请继续反馈。

@guojhq
Copy link
Author

guojhq commented Jan 13, 2023

好吧 我看下,谢谢

@guojhq
Copy link
Author

guojhq commented Jan 13, 2023

用浏览器访问 https://mirror.sjtu.edu.cn/github-release/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.0-1/rubyinstaller-devkit-3.2.0-1-x64.exe 这个链接,跳转到其他URL了,是不是这个原因了,我的浏览器能下载
image

@ccmywish
Copy link
Collaborator

ccmywish commented Jan 13, 2023

了解了,我再研究下。你先试试不用镜像,看看原来的链接(从Github下载那个,你的第一张图)你能用 rbenv 下载安装吗?

@guojhq
Copy link
Author

guojhq commented Jan 13, 2023

原来的链接可以,只是需要我访问github,可能有时候会网络连接失败吧
image

@ccmywish
Copy link
Collaborator

ccmywish commented Jan 13, 2023

我这边提供两个方案供您参考:

  1. 麻烦看下你的 $PSVersionTable 以获得你使用的PowerShell版本。建议您使用 PowerShell core 7.2 以上。因为从开发到现在,308都能正常的处理。通过升级,您的问题应该可以完全得到解决。

  2. 不升级PowerShell. 但是在下图这个文件所示位置添加这一行代码,然后重新运行试试看。我所用的PowerShell运行不到这儿来,所以在我的机器上无法判断是否能解决你的问题,抱歉。

[System.Net.HttpStatusCode]::PermanentRedirect  # HTTP 308

image

@ricardoduarte
Copy link

Hello @ccmywish and @guojhq,

I'm having the same issue. If there is a solution for this, can you please post it here in English?

@ccmywish
Copy link
Collaborator

ccmywish commented Feb 6, 2023

Hi @ricardoduarte

First, I want to ask that, do you try to install directly (that is not via mirror)? If so, the issue you meet is same as #8 . But the situation is very strange, because the default download link is on GitHub, so there is no HTTP code 308. This issue is only met when you try to use the Chinese mirror.

I don't know if the solution above is useful to @guojhq, but here I can translate the method for you:


I offer two schemes for your reference:

  1. Please look at your $PSVersionTable to get the version of PowerShell you are using. It is recommended that you use PowerShell core 7.2 or higher. Since the development until now, HTTP code 308 can always be processed normally on my machine without even noticing. With the upgrade, your problem should be completely resolved.

  2. Do not upgrade PowerShell. But add this line of code in the file shown below and try running it again. My PowerShell doesn't run to that line, so I can't tell if I can solve your problem on my machine. Sorry.

[System.Net.HttpStatusCode]::PermanentRedirect  # HTTP 308

code

@ccmywish ccmywish self-assigned this Feb 6, 2023
@ccmywish ccmywish pinned this issue Feb 6, 2023
@ricardoduarte
Copy link

Thanks for the quick answer @ccmywish, will try these solutions.

@ricardoduarte
Copy link

@ccmywish Now I noticed what was causing my problem. I copied the Powershell config from the project README and didn't delete the line to use a chinese mirror 🤦‍♂️

Now it is working fine, thanks for your help.

@ccmywish
Copy link
Collaborator

ccmywish commented Feb 6, 2023

@ricardoduarte Haha, also good to know it's not a difficult issue for maintenance work 😂

Besides, could you tell me what the PowerShell version you are using? Because I still need to work this out for Chinese users.

@ricardoduarte
Copy link

@ccmywish My Powershell version is 5.1

@ccmywish
Copy link
Collaborator

ccmywish commented Feb 6, 2023

@ricardoduarte Thanks for your information ❤️

@ccmywish ccmywish unpinned this issue Feb 7, 2023
@ccmywish
Copy link
Collaborator

I will close this issue. If there are still any questions, please feel free to come back and ask.

@ccmywish
Copy link
Collaborator

@guojhq

I've fixed it now for PowerShell v5.x series. See #18

此问题属于PowerShell v5.x 系列,现已修复,感谢反馈👍 见 #18

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