简体   繁体   English

bash: /home/XXX/.rvm/scripts/rvm: 没有那个文件或目录

[英]bash: /home/XXX/.rvm/scripts/rvm: No such file or directory

I just walk-through with the installation of Ruby on Rails on Ubuntu using RVM.我只是通过使用 RVM 在 Ubuntu 上安装 Ruby on Rails。

First I have logged in as the root user.首先,我以root用户身份登录。

Then I started with the following commands.然后我开始使用以下命令。

  1. \\curl -sSL https://get.rvm.io | bash -s stable --rails

    It has been installed without any error.它已安装,没有任何错误。

  2. source ~/.rvm/scripts/rvm

    When I run this command.当我运行此命令时。 It showing the error as bash: /home/XXX/.rvm/scripts/rvm: No such file or directory它显示错误为bash: /home/XXX/.rvm/scripts/rvm: No such file or directory

I added the [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"我添加了[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" command in my .bashr file.我的.bashr文件中的[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"命令。

Install RVM:安装 RVM:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Now you will get a success message.现在您将收到一条成功消息。 Then, run this command:然后,运行此命令:

\curl -sSL https://get.rvm.io | bash -s stable

See http://rvm.io/ for more info.有关更多信息,请参阅http://rvm.io/

After installing rvm, try:安装rvm后,尝试:

source ~/.rvm/scripts/rvm

If the above command throws some issue, try this command:如果上述命令引发了一些问题,请尝试以下命令:

source /usr/local/rvm/scripts/rvm

我认为他们可能已经移动了一些固定的文件:

source /usr/share/rvm/scripts/rvm 

Firstly no need to go for sudo access while installing rvm, just follow the very basic commands below首先在安装 rvm 时不需要去 sudo 访问,只需按照下面的非常基本的命令

   $\curl -sSL https://get.rvm.io | bash -s stable

This will install rvm.这将安装 rvm。

   $ rvm list known
   # MRI Rubies
   [ruby-]1.8.6[-p420]
   [ruby-]1.8.7[-p374]
   [ruby-]1.9.1[-p431]
   [ruby-]1.9.2[-p320]
   [ruby-]1.9.3[-p545]
   [ruby-]2.0.0-p353

Install a version of ruby as required.根据需要安装 ruby​​ 版本。

   $ rvm install 2.0.0-p353

Now you can use the version of ruby for which you need to install rails as a gem.现在您可以使用需要安装 rails 作为 gem 的 ruby​​ 版本。

   $ rvm use 2.0.0

Also you can make it default if you want so如果您愿意,您也可以将其设为默认值

   $ rvm use 2.0 --default

Next you can install rails as a gem.接下来,您可以将 rails 安装为 gem。

    $ gem install rails

gems should never be installed with sudo access as they change from project to project. gems 永远不应该使用 sudo 访问权限安装,因为它们从项目到项目发生变化。 rvm helps in managing the different versions of ruby in one m/c. rvm 有助于在一个 m/c 中管理不同版本的 ruby​​。 You can also use gemsets to isolate gems and specific versions from one application to another.您还可以使用 gemset 将 gem 和特定版本从一个应用程序隔离到另一个应用程序。

只需创建 ~/.rvm/scripts/rvm 目录,然后尝试安装 rvm,但请确保您没有以 root 身份登录。

This source /usr/share/rvm/scripts/rvm works for me on ubuntu 20.04.这个source /usr/share/rvm/scripts/rvm在 ubuntu 20.04 上对我source /usr/share/rvm/scripts/rvm I changed the local in /usr/local/rvm/scripts/rvm to share I assume that you have installed the rvm.我改变了当地的/usr/local/rvm/scripts/rvm分享我假设你已经安装了RVM。

Is generally not recommend to install RVM as a root user because of umask security risk.由于 umask 安全风险,一般不建议以 root 用户身份安装 RVM。 Try running these commands as a user.尝试以用户身份运行这些命令。

Downloading RVM (Do not sudo this command)下载 RVM(不要使用此命令)

\curl -sSL https://get.rvm.io | bash -s stable --rails

Then you'll need to add the location to sources(You'll probably need to reload your bash for rvm to work)然后你需要将位置添加到源(你可能需要重新加载你的 bash 以便 rvm 工作)

source ~/.rvm/scripts/rvm

You can install your desired version like so(replace ruby_version with one you would like to install, eg 2.1.4)您可以像这样安装所需的版本(将 ruby​​_version 替换为您想要安装的版本,例如 2.1.4)

rvm install ruby_version

To list the available version on your machine列出您机器上的可用版本

rvm list

To use a version of ruby run使用一个版本的 ruby​​ 运行

rvm use ruby_version

If you have any trouble refere to the RVM website如果您有任何问题,请参阅RVM网站

As root, you traditionally don't have a /home folder.作为 root,您通常没有/home文件夹。 Root's home is different than a normal user. Root 的家与普通用户不同。

You very likely don't want to install RVM as root.您很可能不想以 root 身份安装 RVM。

Please do read the information at http://rvm.io specifically the installation notes.请务必阅读http://rvm.io 上的信息,特别是安装说明。

Can you use sudo find to locate the correct path of the rvm directory?可以用sudo find来定位rvm目录的正确路径吗? If you find the path, you should be able to rerun the source ~/.rvm/scripts/rvm command with the correct path.如果找到路径,您应该能够使用正确的路径重新运行 source ~/.rvm/scripts/rvm 命令。

Also, I fully agree with the previous answers about not creating it as root.另外,我完全同意之前关于不以 root 身份创建它的答案。 DigitalOcean was a pretty good tutorial on adding users https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04 DigitalOcean 是一个很好的添加用户教程https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04

Alright so when you get a failure message "No such file or directory", type好的,所以当您收到失败消息“没有这样的文件或目录”时,请键入

\curl -L https://get.rvm.io | bash -s stable

in your terminal.在您的终端中。 There will be a GPG signature verification failure.会出现GPG签名验证失败。 Bellow that failure there would be a link for github and a key something like this在失败之后会有一个指向 github 的链接和一个类似这样的键

gpg2 --recv-keys 409B6B...

So download a tar file from the github link and run this code to install GPG:所以从github链接下载一个tar文件并运行这个代码来安装GPG:

sudo apt install gnupg2

and run that key :并运行该键:

gpg2 --recv-keys 409B6B...

next run the code:接下来运行代码:

\curl -L https://get.rvm.io | bash -s stable

it will show you installing the rvm and then you can run:它将显示您安装 rvm,然后您可以运行:

source ~/.rvm/scripts/rvm

thats it you are good to go就是这样你很高兴去

如果您通过 apt-get 安装 rvm,您可以将以下行添加到 ~/.zshrc 或 ~/.bashrc

source /etc/profile.d/rvm.sh

Your surest bet is to use home brew.您最确定的选择是使用自制啤酒。 Funny part is if you try brew upgrade ruby, you will have an error if brew wasn't used to install ruby in the first instance so use:有趣的部分是,如果您尝试 brew upgrade ruby​​,如果在第一个实例中未使用 brew 安装 ruby​​,则会出现错误,因此请使用:

$ brew install ruby

Then afterwards use然后之后使用

$ brew upgrade ruby

You may need to close and reopen your terminal to see the effect of the upgrade by typing您可能需要关闭并重新打开终端以通过键入来查看升级的效果

$ ruby -v

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

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