难以理解我实际上是什么Ruby版本和“实际上"/“有效地".跑步 [英] Trouble in understanding what Ruby version I am "actually"/"effectively" running

查看:70
本文介绍了难以理解我实际上是什么Ruby版本和“实际上"/“有效地".跑步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS上,并且正在运行Snow Leopard版本10.6.8.我正在使用RVM来管理我的Ruby安装(并因此使用Ruby on Rails框架),但是当我在日志中看到一些输出时遇到了麻烦,当我收到一些警告时,这些输出大多与当前使用的版本有关/错误信息.也就是说,我以前在终端窗口中运行以下命令:

I am on Mac OS an I am running Snow Leopard Version 10.6.8. I am using RVM in order to manage my Ruby installations (and so to use the Ruby on Rails framework) but I am in trouble when I see some outputs in the log, mostly related to the current version in use when I get some warning/error message. That is, I previously run these commands in the terminal window:

$ which ruby
/<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

$ rvm install 1.9.3
Installing Ruby from source to: /<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching 
...
Fetching yaml-0.1.4.tar.gz to /<ABSOLUTE_PATH>/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /<ABSOLUTE_PATH>/.rvm/src
Configuring yaml in /<ABSOLUTE_PATH>/.rvm/src/yaml-0.1.4.
Compiling yaml in /<ABSOLUTE_PATH>/.rvm/src/yaml-0.1.4.
Installing yaml to /<ABSOLUTE_PATH>/.rvm/usr
ruby-1.9.3-p0 - #configuring 
ruby-1.9.3-p0 - #compiling 
ruby-1.9.3-p0 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.9.3-p0 ...
Installation of rubygems completed successfully.
ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p0 - #importing default gemsets (/<ABSOLUTE_PATH>/.rvm/gemsets/)
Install of ruby-1.9.3-p0 - #complete

$ which ruby
/<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

$ rvm use --default 1.9.3
Using /<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.3-p0

$ which ruby
/<ABSOLUTE_PATH>/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

直到这里看起来还可以.

Until here it seems to be OK.

但是,当出现类似

However, when I get some error like in this question related to the DelayedJob gem, I see in the log that the system is using still Ruby 1.9.2-p290:

# Note the 'ruby-1.9.2-p290'
undefined method `send_register_email\' for #<Syck::DomainType:0x00000108e2f870>\n/<ABSOLUTE_PATH>/.rvm/gems/ruby-1.9.2-p290/gems/delayed_job-3.0.1/lib/delayed/performable_mailer.rb:6:in
...

怎么了?我该如何解决这个问题?

推荐答案

,如@sarnold建议的那样,您将必须重新启动任何长时间运行的进程,例如守护程序.

as @sarnold suggests you will have to restart any long running processes such as daemons.

另一件事是,如果它在cron选项卡中运行,请确保cron任务以正确的用户身份运行.如果您是为某个用户而不是系统设置RVM,则root或您未为其设置RVM的其他任何用户都将使用系统ruby.

Another thing is that if it is running in a cron tab, make sure the cron task is running as the right user. If you set up RVM for a user, and not the system, then root, or any other user than you didn't set up RVM for, will be using system ruby.

您仔细地摘了"

请注意,这很容易发生

sudo rake some:task # that has to do something as root like open a low port or move a file

这将以root身份运行,并且不会进行正确的RVM采购.要解决此问题,有

this will run as root and not do the right RVM sourcing. To fix this, there is

rvmsudo rake some:task

这篇关于难以理解我实际上是什么Ruby版本和“实际上"/“有效地".跑步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆