开发者

RVM & Unicorn deploy

开发者 https://www.devze.com 2023-03-11 14:47 出处:网络
My RVM is installed as root. When I\'m trying to start unicorn socket, it prints user@9001-3:~$ /etc/init.d/unicorn start

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
unicor开发者_Python百科n.

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


/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.


Symlink also works,

which ruby<your version>
ln-s /ruby/path/ruby<your version> /ruby/path/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)


I had the same problem and this for me

rvm --default use <version>
0

精彩评论

暂无评论...
验证码 换一张
取 消