简体   繁体   English

Ubuntu的“宝石安装轨道”失败

[英]Ubuntu “gem install rails” fails

I'm on ubuntu working with rails here What do I get when I try to install gem? 我在使用rails的ubuntu上,尝试安装gem时会得到什么? Here it is 这里是

$ gem install rails
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.1.0 directory.

what should I have to do to get it to work? 我应该怎么做才能使其正常工作?

Normal user accounts generally don't have the ability (often called permissions or privilege) to write to files in the root (starts with "/") directory. 普通用户帐户通常没有能力(通常称为权限或特权)写入根目录(以“ /”开头)中的文件。

You need to elevate your privilege to that of a superuser, aka the root user. 您需要将特权提升为超级用户(即根用户)的特权。 The most common way is to type 最常见的方式是键入

sudo [the command you wanted to run]

So type 所以输入

sudo gem install rails

The system will ask you for your password and if it's your first time running sudo, it will warn you to be careful. 系统会要求您输入密码,如果这是您第一次运行sudo,它将警告您要小心。 :) :)

Edit: Listen to iceman's comment about using rvm or rbenv instead. 编辑:听听iceman关于使用rvm或rbenv代替的评论。 Even though using sudo works for this, that does not mean it is the best option. 即使使用sudo可以做到这一点,但这并不意味着它是最佳选择。

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

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