退格键和箭头键在 Windows 计算机上的 IRB(Git Bash 控制台)中不起作用
我刚刚在 Windows 机器上安装了 ruby 1.9.2,退格键或任何其他箭头键不起作用。仅当我在 Git Bash 控制台上打开 IRB 时才会发生这种情况。但它在 Windows 控制台上运行良好。有什么帮助吗?
注意:IRB 在使用早期版本的 ruby 的两个控制台上都可以正常工作。
I just installed ruby 1.9.2 on windows machine and Backspace or any other arrow keys don't work. This happens only when I open IRB on Git Bash console. But it works fine on Windows console. Any help on that?
Note: IRB was working fine on both consoles with the earlier versions of ruby.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
同样的事情也发生在我身上。使用 --noreadline 运行 irb 解决了我的问题:
Same thing happened to me. Running irb with --noreadline solved my problem:
看来你在编译 ruby 时没有安装 readline 。所以安装readline,也许也安装readline-devel,然后重新编译ruby。
Seems you didn't have readline installed while compile ruby. So install readline, maybe also readline-devel, then recompile ruby.
您还可以在 ~/.irbrc 中禁用 readline
You can also disable readline in ~/.irbrc
如此处所述 https://groups.google.com/forum/#! topic/rubyinstaller/HgswOz1T-eE,使用以下命令/别名:
如果这不起作用,请改用 pry:
As documented here https://groups.google.com/forum/#!topic/rubyinstaller/HgswOz1T-eE, use the below command/alias:
If that doesn't work, use pry instead:
安装 rb-readline gem。
Install the rb-readline gem.
简短的回答我必须进行brew升级,(根据我采访过的一位Ruby专家的说法,情况显然是“主干中有一个新的默认gem,Reline,这是一个readline后备。”)。然后 irb 中的新窗口和箭头键就起作用了。然后 sudo gem install pry,新窗口,pry 工作了。 ruby --version 下降到 2.3,我必须执行brew install ruby,它说已经安装了ruby 2.6,并且要执行brew reinstall ruby,并且它说要更新路径,我这样做了,然后就好了。安装红宝石2.6。编辑-现在 Rails 坏了..我会进一步更新。
更详细的答案。
我遇到了 ruby irb 箭头键不起作用的问题,
我在 osx 上,并且认为几个月前我没有遇到过这个问题
,并且在启动 pry 时也遇到了错误,
pry;它说“原因:找不到图像 - /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/x86_64-darwin16/readline.bundle”
我尝试了
brew link readline --force
它没有帮助,我尝试了irb --noreadline
它没有帮助但是对我有用的是来自 ruby 专家的 -
brew升级
根据我采访过的一位 ruby 专家的说法,情况是“主干中有一个新的默认 gem,Reline,这是一个 readline 后备。”
然后我启动了一个新的终端窗口,$irb 使用箭头键工作。
然后我执行了 sudo gem install pry ,打开了一个新的终端窗口,并且 pry 工作了。
Ruby 回落到 2.3,而实际上应该是 2.6,我以为是 2.6
所以我执行了
brew install ruby
,它说 ruby 2.6 已经安装,并建议brew 重新安装 ruby
>。所以我做了brew reinstall ruby
。打开一个新的终端窗口。当时还是2.3。但它建议将export PATH="/usr/local/opt/ruby/bin:$PATH"
添加到 .bash_profile (osx 上自动运行的文件)。我这样做是行不通的,但是在每个终端会话开始时手动执行PATH="/usr/local/opt/ruby/bin:$PATH"
是有效的。编辑-现在 Rails 坏了,我会进一步更新。
当我更新路径后运行gem时,我让gem开始工作。
这个解决方案并不理想,因为它提供了两个版本的ruby,因此当然也提供了两个版本的gem
Brief answer I had to do brew upgrade,(Apparently the situation, according to a ruby expert I spoke to, is that "There's a new default gem in trunk, Reline, that's a readline fallback.") . Then a new window and arrow keys in irb worked. Then sudo gem install pry, new window, and pry worked. ruby --version fell to 2.3 and I had to do brew install ruby, it said ruby 2.6 already installed and to do brew reinstall ruby, and it said to update the path, I did that and then fine. ruby 2.6 installed. edit- now rails is broken.. i'll update further.
More elaborate answer.
I had this issue of ruby irb arrow keys not working,
I am on osx, and don't think I had this issue some months ago
and also had an error when starting pry,
pry<ENTER> it says "Reason: image not found - /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/x86_64-darwin16/readline.bundle"
I tried
brew link readline --force
it didn't help, I triedirb --noreadline
it didn't helpBut what worked for me was this from a ruby expert-
brew upgrade
Apparently the situation, according to a ruby expert I spoke to, is that "There's a new default gem in trunk, Reline, that's a readline fallback."
Then I started a new terminal window and $irb worked with arrow keys.
I then did
sudo gem install pry
, opened a new terminal window, and pry worked.Ruby fell back to 2.3 when it should really be 2.6 and I thought it was 2.6
So I did
brew install ruby
, it said ruby 2.6 was already installed, and suggestedbrew reinstall ruby
. so I didbrew reinstall ruby
. Opened a new terminal window. It was still on 2.3. But it suggested addingexport PATH="/usr/local/opt/ruby/bin:$PATH"
to .bash_profile (a file on osx that runs automatically). I did that it didn't work, but doingPATH="/usr/local/opt/ruby/bin:$PATH"
manually at the start of each terminal session works.edit- now rails is broken , i'll update further.
I got gem to work when I ran the one after updating the path..
This solution is not ideal as it gives two versions of ruby, and thus of course two versions of gem