保存安装宝石的不同方式的位置?

发布于 2024-10-10 01:05:38 字数 198 浏览 0 评论 0原文

以下命令的保存位置有什么不同吗?:

gem install some_gem
sudo gem install some_gem
bundle install

bundle install 适用于 Rails 3 项目。

都是将安装的gem保存在同一个目录还是不同目录?

Are there any differences in the save locations for the following commands?:

gem install some_gem
sudo gem install some_gem
bundle install

bundle install is for rails 3 project.

Will all of them save the installed gem in the same directory or in different directories?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

行至春深 2024-10-17 01:05:38

可能在不同的目录中,因为“root”用户具有与您不同的帐户和路径。

通过 sudo 进行 root 访问将允许将文件写入 /usr/bin/usr/local/bin 中 Ruby 的 gem 环境代码> 目录。 (Gem 不会将文件放在那里,但它们会与这些目录之一中的 Ruby 相关联。)

默认情况下,您无权写入这些区域,因此如果您尝试运行 gem安装,并且只有系统 Ruby,您可能会收到权限错误,并且尝试应该失败。

Probably in different directories, because the "root" user has a different account and path than you do.

Root's access via sudo will allow the file to be written to the gem environment for a Ruby in the /usr/bin or /usr/local/bin directories. (Gem won't put the files there, but they'll be associated with a Ruby in one of those directories.)

You don't have access to write to those areas by default, so if you tried to run gem install, and only had a System Ruby, you'd probably get permission errors and the attempt should fail.

离鸿 2024-10-17 01:05:38

铁皮人回答了 sudo 与非 sudo,因此对于捆绑程序...

Bundler 将 gems 安装到系统路径(类似于它们是由 sudo 安装的) code>sudo)——至少在 OSX 上,尽管我想其他操作系统也是一样的。

The Tin Man answered sudo vs. non-sudo, so as for bundler...

Bundler installs gems to the system path (similarly to if they'd been installed by sudo)--at least on OSX, though I imagine other OS would be the same.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文