简体   繁体   English

安装Ruby-Digital Ocean-RVM-不稳定的红宝石版本-无法安装Gems

[英]Installing Ruby - Digital Ocean - RVM - Unstable ruby version - Can't install Gems

I am trying to install Ruby & Rails on DigitalOcean droplet, I have downloaded ruby 2.5.1 with RVM but when I check version it says 2.31 and when I list available versions I get only 2.5.1. 我正在尝试在DigitalOcean Droplet上安装Ruby&Rails,我已经用RVM下载了ruby 2.5.1,但是当我检查版本为2.31时,当我列出可用版本时,我只有2.5.1。

I have tried rvm use 2.5.1 I got below problem 我尝试了rvm use 2.5.1我遇到了以下问题

在此处输入图片说明

I fix it by running source ~/.rvm/scripts/rvm , then rvm use 2.5.1 and run bundle install , I get the following error, 我通过运行source ~/.rvm/scripts/rvm修复它,然后rvm use 2.5.1并运行bundle install ,我得到以下错误,

can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException) 找不到具有可执行包(Gem :: GemNotFoundException)的gem bundler(> = 0.a)

在此处输入图片说明

Below show the unstable issues faced from RVM and ruby versions 下面显示了RVM和ruby版本面临的不稳定问题

在此处输入图片说明

在此处输入图片说明

UPDATE UPDATE

When I ssh into the server and run ruby -v, I get 2.5.1, then if I run 当我SSH进入服务器并运行ruby -v时,我得到2.5.1,然后如果我运行

/bin/bash --login / bin / bash-登录

I check ruby -v, its 2.5.1 我检查ruby -v,其2.5.1

install ruby 2.5.1 first, from your image it seems rvm already installed correctly you just need to install it (it shows from your list command) 首先安装ruby 2.5.1,从您的映像中看来rvm已经正确安装,您只需要安装它(它在list命令中显示)

rvm install 2.5.1
# this to install version 2.5.1
rvm use 2.5.1
# active ruby 2.5.1
ruby -v
# check your version and make sure it said 2.5.1 

to install bundler to your home directory use 安装捆绑程序到您的主目录使用

# after you active ruby 2.5.1 then install bundler
gem install bundler 
# my suggestion do not install with sudo
# in case you still has write problem below is other solution suggested [from here][1]
gem install bundler --user-install

This will install Bundler into your home directory . 这会将Bundler安装到您的主目录中 Note that you will need to append ~/.gem/ruby//bin to your $PATH variable to use bundle. 请注意,您需要在$ PATH变量后附加〜/ .gem / ruby​​ // bin才能使用包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM