Ruby-on-rails bash: /home/XXX/.rvm/scripts/rvm: 没有那个文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26795891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bash: /home/XXX/.rvm/scripts/rvm: No such file or directory
提问by user3909863
I just walk-through with the installation of Ruby on Rails on ubuntu using RVM.
我只是通过使用 RVM 在 ubuntu 上安装 Ruby on Rails。
First I have logged me as rootuser.
首先,我以root用户身份登录。
Then I started with the following commands.
然后我开始使用以下命令。
\curl -sSL https://get.rvm.io | bash -s stable --railsIt has been installed without any error.
source ~/.rvm/scripts/rvmWhen I run this command. It showing the error as bash: /home/XXX/.rvm/scripts/rvm: No such file or directory
\curl -sSL https://get.rvm.io | bash -s stable --rails它已安装,没有任何错误。
source ~/.rvm/scripts/rvm当我运行此命令时。它显示错误为bash: /home/XXX/.rvm/scripts/rvm: No such file or directory
I added the [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"command in my .bashrfile.
我[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"在我的.bashr文件中添加了命令。
Thanks in advance.
提前致谢。
回答by sudeep_dk
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/。
回答by nbsamar
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
回答by kyle
I think they may have moved some files around fixed with:
我认为他们可能已经移动了一些固定的文件:
source /usr/share/rvm/scripts/rvm
回答by Bijendra
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. rvm helps in managing the different versions of ruby in one m/c. You can also use gemsets to isolate gems and specific versions from one application to another.
gems 永远不应该使用 sudo 访问权限安装,因为它们从项目到项目发生变化。rvm 有助于在一个 m/c 中管理不同版本的 ruby。您还可以使用 gemset 将 gem 和特定版本从一个应用程序隔离到另一个应用程序。
回答by Snm Maurya
just create ~/.rvm/scripts/rvm directories, then try to install rvm but make sure you are not logged in as root.
只需创建 ~/.rvm/scripts/rvm 目录,然后尝试安装 rvm,但请确保您没有以 root 身份登录。
回答by Darshil Rathod
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. Bellow that failure there would be a link for github and a key something like this
在您的终端中。会出现GPG签名验证失败。在失败之后会有一个指向 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
就是这样你很高兴去
回答by Benji
Is generally not recommendto install RVM as a root user because of umask security risk. Try running these commands as a user.
由于 umask 安全风险,一般不建议以 root 用户身份安装 RVM。尝试以用户身份运行这些命令。
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 RVMwebsite
如果您有任何问题,请参阅RVM网站
回答by vgoff
As root, you traditionally don't have a /homefolder. Root's home is different than a normal user.
作为 root,您通常没有/home文件夹。Root 的家与普通用户不同。
You very likely don't want to install RVM as root.
您很可能不想以 root 身份安装 RVM。
Please do read the information at http://rvm.iospecifically the installation notes.
请务必阅读http://rvm.io 上的信息,特别是安装说明。
回答by Oakland510
Can you use sudo find to locate the correct path of the rvm directory? If you find the path, you should be able to rerun the source ~/.rvm/scripts/rvm command with the correct path.
可以用sudo find来定位rvm目录的正确路径吗?如果找到路径,您应该能够使用正确的路径重新运行源 ~/.rvm/scripts/rvm 命令。
Also, I fully agree with the previous answers about not creating it as root. DigitalOcean was a pretty good tutorial on adding users https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
另外,我完全同意之前关于不以 root 身份创建它的答案。DigitalOcean 是一个很好的添加用户教程https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
回答by Caleb Mbakwe
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

