RVM和独角兽部署

发布于 2024-11-14 12:15:27 字数 519 浏览 8 评论 0原文

我的 RVM 以 root 身份安装。 当我尝试启动 unicorn 套接字时,它会打印

user@9001-3:~$ /etc/init.d/unicorn start
Starting myapp app: /usr/bin/env: ruby: No such file or directory
unicorn.

But if I type

user@9001-3:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

/usr/local/rvm/gems/ruby-1.9.2-p180/bin/unicorn path contains.

我的独角兽配置: https://gist.github.com/1010519

My RVM is installed as root.
When I'm trying to start unicorn socket, it prints

user@9001-3:~$ /etc/init.d/unicorn start
Starting myapp app: /usr/bin/env: ruby: No such file or directory
unicorn.

But if I type

user@9001-3:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

/usr/local/rvm/gems/ruby-1.9.2-p180/bin/unicorn path exists.

My unicorn config: https://gist.github.com/1010519

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

云柯 2024-11-21 12:15:27

/etc/init.d/unicorn 不知道在哪里可以找到 Ruby,因为它是通过 RVM 管理的。通常,您的 .bashrc 或类似文件会被执行并设置环境;这不会发生在初始化脚本中(或者可能由 root 执行的任何其他脚本)。

解决方案是使用包装器。例如,要创建一个名为 system_ruby 的二进制文件来加载 RVM 的 1.9.2p180 环境并然后执行 ruby,请执行以下命令:

rvm wrapper ruby-1.9.2-p180 system ruby

了解更多信息和更多详细信息,请查看我的这个答案 ,它解决了类似的问题。

/etc/init.d/unicorn doesn't know where to find Ruby because it's managed via RVM. Normally, your .bashrc or similar file is executed and sets up the environment; this doesn't happen in init scripts (or likely anything else executed by root).

The solution is to use wrappers. For example, to create a binary called system_ruby that loads up RVM's 1.9.2p180 environment and then executes ruby, execute the following:

rvm wrapper ruby-1.9.2-p180 system ruby

For more information and more details, check out this answer of mine, which addresses a similar problem.

他不在意 2024-11-21 12:15:27

符号链接也有效,

which ruby<your version>
ln-s /ruby/path/ruby<your version> /ruby/path/ruby

Symlink also works,

which ruby<your version>
ln-s /ruby/path/ruby<your version> /ruby/path/ruby
娇俏 2024-11-21 12:15:27

类型 :
which ruby​​ (显示 ruby​​ bin 路径),然后输入:ln -s (change_to_ruby_path) /usr/bin/env/ruby (为您的系统构建正确的访问权限)

Type :
which ruby (show the ruby bin path) then type this : ln -s (change_to_ruby_path) /usr/bin/env/ruby (construct the correct access for your system)

只是一片海 2024-11-21 12:15:27

我遇到了同样的问题,这对我来说

rvm --default use <version>

I had the same problem and this for me

rvm --default use <version>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文