如何以普通用户身份运行捆绑安装 [英] How to run bundle install as normal user

查看:87
本文介绍了如何以普通用户身份运行捆绑安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用捆绑安装。我不是Ruby用户-这是我第一次真正涉猎rake。我只是尝试使用ThrowtheSwitch.org中的一些使用Rake的软件包,等等。

I am attempting to use bundle install. I am not a Ruby user - this is my first real foray into even running rake. I'm simply trying to user some packages from ThrowtheSwitch.org that use Rake and so on.

几天前我最初使用以下方法安装了ruby:

I initially installed ruby several days ago using:

sudo apt-get install ruby-full

这使我可以在Unity测试框架中使用rake。现在,我想使用CMock。使用CMock的说明说 cd 进入目录,然后

This allowed me to use rake with Unity testing framework. Now I'd like to use CMock. the instructions for using CMock say to cd into the directory then

$ bundle install
$ bundle exec rake

所以我使用以下方式安装捆绑器:

So I install bundler using:

$ sudo apt-get install bundler

,但随后运行捆绑安装时,不断要求我输入密码。所以我尝试:

But then running the bundle install continuously asks me for my password. So I try:

$ gem install bundler

对/var/lib/gems/1.9.1的写权限失败。所以我尝试:

Which fails for write permissions on /var/lib/gems/1.9.1. So I try:

$ sudo gem install bundler

可以正常安装,因此我再次尝试。但是仍然不断询问我的密码。所以我尝试:

which installs OK so I try the bundle install again. But still get continuously asked for my password. So I try:

$ sudo bundle install

并得到警告,我不应该以root用户身份运行捆绑程序:

And get a warning that I should not run bundler as root:


不要运行捆绑者为根。 Bundler可以询问是否需要sudo,并且以root用户身份安装捆绑包会破坏该计算机上所有非root用户的应用程序。

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.

如何正确安装它,以便可以按预期运行它?

How can I install this properly so that I can run it as expected?

注意:我已经看到有关此主题的其他问题,没有一个我理解了答案,因此让我强调自己不是红宝石(甚至不是Web开发人员)开发人员-我尽可能地以通俗易懂的方式来使用它。

Note: I have seen that there are several other questions on this topic, none of which I understood the answers to so let me underline that I am not a ruby (or even web stack) dev - I need this in layman's terms as much as possible.

另请注意:我确实看到了RVM和rbenv的一些提及。我不确定它们是否特别与这些问题有关,还是需要一个或两个。我目前都没有。

Note also: I did see several mentions of RVM and rbenv. I'm not sure if they were incidental to those questions in particular or if one or both is required. I do not currently have either. Am about to research exactly what they are now.

请注意第三点:我的平台是WSL(类似于Ubuntu)。

Note the third: My platform is WSL (so Ubuntu, kind of).

推荐答案

我现在只使用Ruby几周了。我会说,我知道你在哪里。对于您在评论中的最后一个问题,我不会提供太多帮助,但我会说,我的理解是这两个命令是不同的。

I've been working with Ruby only a few weeks now. I'll say, I know where you are. I am not about to help much but will say, to your last question in the comments, that my understanding is that the two commands are different.

我对一个简短答案的理解..一个人可以拥有他们需要使用的diff版本的Ruby(旧项目等),而并非每个版本的Ruby都能运行给定宝石的版本。因此,可以使用rbenv或rvm来帮助管理使用特定版本的ruby设置项目,然后安装所需的gem的技巧。

My understanding of a short answer.. One can have diff versions of Ruby they need to work with (legacy projects, etc) and not every version of Ruby can run every version of a given gem. For this reason, one can use rbenv or rvm to help manage the art of setting up a project with a particular version of ruby and then installing the needed gems.

我一直在Mac上使用rvm,在Linux上使用rbenv,发现它们两者的相似性足以满足我一直在做的简单工作。在Linux上安装rbenv证明稍微容易一些。正确设置后,不再需要sudo来安装gems-这是首选。我建议尝试其中一种,并按照其网站说明进行安装。设置完成后,事情应该会更加顺利。

I've been working with rvm on my mac and rbenv in linux and find them both similar enough for the simple stuff I've been doing. Installing rbenv on linux proved slightly easier. Once set up properly, sudo is no longer needed to install gems - which is preferred. I would recommend trying one of these and installing per their website instructions. Things should go smoother once set up.

这篇关于如何以普通用户身份运行捆绑安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆