问题
I'm trying to deploy my Rails app project to my Digital Ocean vps using this guide.
When it says:
cap production deploy:check
I get a error:
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
I ran:
rbenv install 2.1.2
Which resulted in:
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
When I check rbenv -v I get:
rbenv 0.4.0-129-g7e0e85b
When I check in my filescreen and go to /home/alucardu/.rbenv/versions/2.1.2
there's content there.
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?
回答1:
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!
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...
So the "fix" is:
- log in to the server as root user with ssh root@<server_ip>
- now, install ruby 2.1.2 as root with rbenv install 2.1.2
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.
来源:https://stackoverflow.com/questions/26684008/error-rbenv-2-1-2-is-not-installed-or-not-found