简体   繁体   English

如何在不使用sudo gem install的情况下安装Rails

[英]How to install Rails without using sudo gem install

I have installed rbenv using Homebrew. 我已经使用Homebrew安装了rbenv。

$ rbenv local
2.4.0

$ rbenv global
2.4.0

$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

When I check the Rails version I get the following message; 当我检查Rails版本时,会收到以下消息;

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

I have been told not to install Rails using sudo, so I have tried running gem install rails but it gives me the following error; 有人告诉我不要使用sudo安装Rails,所以我尝试运行gem install rails但是它给了我以下错误;

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen -        /Users/USER1/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.6/.rspec

Is it correct that I should not install rails with sudo, and if so how can I? 我不应该使用sudo安装rails是否正确,如果可以,我该怎么办?

I installed RVM (requires download and use of GPG) and followed the steps on RVM's install page. 我安装了RVM(需要下载和使用GPG),并按照RVM的安装页面上的步骤进行操作。 Should you use sudo? 您应该使用sudo吗? I've read both ways. 我已经阅读了两种方式。 Here is the page link: 这是页面链接:

https://rvm.io/rvm/install https://rvm.io/rvm/install

The command once RVM is installed: RVM安装完成后的命令:

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

That will install the latest stable version of rails available. 这将安装可用的最新稳定版本的rails。 I did this as a complete novice and it has worked for me (as a slightly higher novice) so far. 我作为一个完整的新手来完成此操作,到目前为止,它对我(作为一个稍微高一点的新手)还是有用的。

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

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