问题描述
我正在尝试使用指南。
I'm trying to deploy my Rails app project to my Digital Ocean vps using this guide.
它说:
cap production deploy:check
我遇到错误:
DEBUG [8906f2ab] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.1.2 ] on 178.62.204.53
DEBUG [8906f2ab] Command: [ ! -d ~/.rbenv/versions/2.1.2 ]
DEBUG [8906f2ab] Finished in 1.320 seconds with exit status 0 (successful).
ERROR rbenv: 2.1.2 is not installed or not found in ~/.rbenv/versions/2.1.2
我运行了:
rbenv install 2.1.2
这导致了
Downloading ruby-2.1.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/f22a6447811a81f3c808d1c2a5ce3b5f5f0955c68c9a749182feb425589e6635
Installing ruby-2.1.2...
Installed ruby-2.1.2 to /home/alucardu/.rbenv/versions/2.1.2
当我检查rbenv -v时,我得到:
When I check rbenv -v I get:
rbenv 0.4.0-129-g7e0e85b
当我检查在我的文件屏幕中,转到 /home/alucardu/.rbenv/versions/2.1.2
那里有内容。
When I check in my filescreen and go to /home/alucardu/.rbenv/versions/2.1.2
there's content there.
当我检查Ruby时,我得到了:
And when I check my Ruby I get:
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
有人可以指出我的问题所在吗?
Could someone point me where the problem is?
推荐答案
在哪里运行 rbenv install 2.1.2
命令?本地还是在服务器上?
Capistrano需要在服务器上安装 ruby
!
Where did you run the rbenv install 2.1.2
command? Locally or on the server?Capistrano requires ruby
to be installed on the server!
此外,需要为与您一起部署的用户安装ruby
。
您所遵循的教程似乎建议使用 root
用户进行部署(可能不是最佳实践),因此在这种情况下 capistrano
会在root的主目录 /root/.rbenv ...
Also, ruby
needs to be installed for the user you're deploying with.It seems the tutorial you're following suggests to do the deployment with the root
user (probably not the best practice), so in that case capistrano
will look for ruby in root's home dir /root/.rbenv...
因此,修复是:
-使用root用户以 ssh root @< server_ip>
登录到服务器-现在,以 rbenv作为根目录安装ruby 2.1.2
如果您不想为了解决这个问题,我专门为此创建了一个插件目的。该插件可确保您不必再担心Ruby版本。
In case you don't want to mess with that, I created a capistrano-rbnev-install plugin specifically for this purpose. The plugin ensures that you don't have to worry about ruby versions anymore.
这篇关于错误rbenv:2.1.2未安装或未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!