繁体   English   中英

在重启shell Ubuntu 16后找不到RVM安装的ruby

[英]RVM installed ruby not found after restart of shell Ubuntu 16

我已经安装了RVM和ruby,起初它似乎工作,但每当我打开一个新的shell选项卡或窗口时,只能找到rvm,而不是ruby。

运行rvm -v给了我一个不错的小输出:

rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

但运行ruby -vgem -vrails -v给我一个错误告诉我apt-get install ruby/rails

我通过以下命令安装了rvm:

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

我这样安装ruby:

rvm install 2.3.1
rvm use 2.3.1 --default

使用以下命令安装Rails:

gem install rails

我尝试过的:

我已经检查了我的.bashrc .bash_profile和我的.profile ,它与以下设置很好:

.bashrc.profile

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

.bash_profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

什么有用:

运行行source ~/.rvm/scripts/rvm可以再次找到rubygemrails ,但是必须重复这个是每个新的选项卡或窗口。

如何修复以便rvm安装的模块能够自动运行?

事实证明一切都设置得很好而且正确。 如果您遇到此问题,则表明您的shell设置存在问题。 您需要将您的配置文件设置为登录shell

如何在Ubuntu标准GUI的标准终端中进行设置

(GNOME终端Unity)

通过进入菜单和图片Terminal > Preferences访问您的设置。

在弹出的窗口中,选择选项卡菜单中的Profiles 选择是否要创建新配置文件或编辑现有默认配置文件。 在出现的窗口中(无论您的图片如何都是相同的)转到选项卡Command并启用Run command as a login shell

重新启动终端,你会发现你的rvm命令现在正在运行。

如何添加到.profile或.bashrc

echo "source $HOME/.rvm/scripts/rvm" >> ~/.profile

编辑

您需要从.profile.bashrc NOT .bash_profile调用source

jperez@asus-kubuntu16:~$ grep bash_profile .profile                                                                                                                 
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
jperez@asus-kubuntu16:~$

在Deepin终端运行: sudo nano ~/.config/deepin/deepin-terminal/config.conf

并将run_as_login_shell = false更改为true

> sudo apt-get update
> sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
> sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
> gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
> \curl -sSL https://get.rvm.io | bash -s stable
> source ~/.rvm/scripts/rvm
> rvm install 2.3.1
> rvm use 2.3.1 --default
> ruby -v

暂无
暂无

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

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