Ruby 使用 RVM 加载时挂起
Ruby hangs on load using RVM
使用 RVM 安装了 ruby 2.4.0,但在键入 ruby 后,命令会无限期地冻结。可以按 ctrl-C 退出,但 ruby 永远不会加载。
Ruby 信息:
ruby-2.4.0:
system:
uname: "Linux waffleboy 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux"
name: "Ubuntu"
version: "16.04"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.1.1 (x86_64-ubuntu-linux-gnu)"
remote path: "ubuntu/16.04/x86_64"
rvm:
version: "rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]"
updated: "23 minutes 20 seconds ago"
path: "/home/waffleboy/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.4.0p0"
date: "2016-12-24"
platform: "x86_64-linux"
patchlevel: "2016-12-24 revision 57164"
full_version: "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]"
homes:
gem: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
binaries:
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/ruby"
irb: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/irb"
gem: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/gem"
rake: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/rake"
environment:
PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0/bin:/home/waffleboy/.rvm/gems/ruby-2.4.0@global/bin:/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin:/storage/anaconda3/bin:/home/waffleboy/bin:/home/waffleboy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/bin:/storage/programfiles/:/home/waffleboy/bin:/storage/programfiles/spark-1.6.2/bin:/home/waffleboy/.rvm/bin"
GEM_HOME: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
GEM_PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0:/home/waffleboy/.rvm/gems/ruby-2.4.0@global"
MY_RUBY_HOME: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
IRBRC: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/.irbrc"
RUBYOPT: ""
gemset: ""
Rvm 列表:
rvm rubies
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我已经尝试重新安装和安装 ruby 多次,但它似乎不起作用。
谁能指出我正确的方向? :) 谢谢!
如果您正在寻找一个 REPL 来输入 Ruby 代码,执行它并查看结果,那么您正在寻找 irb
命令,而不是 ruby
.
ruby
用于 运行 个文件(例如 ruby my_file.rb
),或者不带参数将读取输入标准输入的脚本,当您退出时将执行该脚本 ruby
用 cmd+D.
这是正常的;这是一个功能,而不是错误。
运行 ruby
,没有任何参数,导致程序 运行 并等待接收来自 STDIN
的输入(以 EOF
字符结尾).在收到此信息之前,它不会执行任何操作。
如果你想 运行 ruby 在 交互 模式下,(就像你 运行 python
一样),那么使用 ruby 的内置 irb
("interactive ruby") 命令。
或者,如果您只想显示有关安装的 ruby 版本的一些基本信息,那么您可以尝试以下命令:
ruby -v # Display version information
ruby -h # Display help about usage, switches and features
使用 RVM 安装了 ruby 2.4.0,但在键入 ruby 后,命令会无限期地冻结。可以按 ctrl-C 退出,但 ruby 永远不会加载。
Ruby 信息:
ruby-2.4.0:
system:
uname: "Linux waffleboy 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux"
name: "Ubuntu"
version: "16.04"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.1.1 (x86_64-ubuntu-linux-gnu)"
remote path: "ubuntu/16.04/x86_64"
rvm:
version: "rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]"
updated: "23 minutes 20 seconds ago"
path: "/home/waffleboy/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.4.0p0"
date: "2016-12-24"
platform: "x86_64-linux"
patchlevel: "2016-12-24 revision 57164"
full_version: "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]"
homes:
gem: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
binaries:
ruby: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/ruby"
irb: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/irb"
gem: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/gem"
rake: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin/rake"
environment:
PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0/bin:/home/waffleboy/.rvm/gems/ruby-2.4.0@global/bin:/home/waffleboy/.rvm/rubies/ruby-2.4.0/bin:/storage/anaconda3/bin:/home/waffleboy/bin:/home/waffleboy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/bin:/storage/programfiles/:/home/waffleboy/bin:/storage/programfiles/spark-1.6.2/bin:/home/waffleboy/.rvm/bin"
GEM_HOME: "/home/waffleboy/.rvm/gems/ruby-2.4.0"
GEM_PATH: "/home/waffleboy/.rvm/gems/ruby-2.4.0:/home/waffleboy/.rvm/gems/ruby-2.4.0@global"
MY_RUBY_HOME: "/home/waffleboy/.rvm/rubies/ruby-2.4.0"
IRBRC: "/home/waffleboy/.rvm/rubies/ruby-2.4.0/.irbrc"
RUBYOPT: ""
gemset: ""
Rvm 列表:
rvm rubies
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我已经尝试重新安装和安装 ruby 多次,但它似乎不起作用。
谁能指出我正确的方向? :) 谢谢!
如果您正在寻找一个 REPL 来输入 Ruby 代码,执行它并查看结果,那么您正在寻找 irb
命令,而不是 ruby
.
ruby
用于 运行 个文件(例如 ruby my_file.rb
),或者不带参数将读取输入标准输入的脚本,当您退出时将执行该脚本 ruby
用 cmd+D.
这是正常的;这是一个功能,而不是错误。
运行 ruby
,没有任何参数,导致程序 运行 并等待接收来自 STDIN
的输入(以 EOF
字符结尾).在收到此信息之前,它不会执行任何操作。
如果你想 运行 ruby 在 交互 模式下,(就像你 运行 python
一样),那么使用 ruby 的内置 irb
("interactive ruby") 命令。
或者,如果您只想显示有关安装的 ruby 版本的一些基本信息,那么您可以尝试以下命令:
ruby -v # Display version information
ruby -h # Display help about usage, switches and features