简体   繁体   English

在 Ruby on Rails 安装中,是什么导致 webrick 过时以及为什么 `gem i webrick` 可以更新它?

[英]In a Ruby on Rails installation, what is causing webrick to be outdated and why `gem i webrick` can update it?

I have a new Mac computer and installed rails on it, and then I tried out the command我有一台新的Mac电脑并在上面安装了rails,然后我尝试了命令

gem outdated

for some reason, it showed one of the gems outdated:出于某种原因,它显示了其中一个已过时的宝石:

webrick (1.4.2 < 1.6.0)

I wonder why it is outdated on the first installed, and when I did我想知道为什么它在第一次安装时就已经过时了,我什么时候安装的

sudo gem install webrick

it actually installed 1.6.0 onto the system.它实际上将 1.6.0 安装到系统上。 Doesn't it require gem update instead of install to update something?它不需要gem update而不是install来更新一些东西吗? How come install also updated it?怎么install也更新了?

Not exactly, gem install GEM_NAME will install the last version available if you don't specify a version when installing, and you can have more than 1 version of the same gem on your machine.不完全是,如果您在安装时未指定版本, gem install GEM_NAME将安装可用的最后一个版本,并且您的机器上可以有多个相同的 gem 版本。

you can run gem environment , and check where gems are installed, go to that folder and you will see both version gems folder there.您可以运行gem environment ,并检查 gem 的安装位置,go 到该文件夹,您将在那里看到两个版本的 gems 文件夹。

so when you create a rails project for example and add a specific version of a gem in the gemfile and another version on another project, you can have both without problems因此,例如,当您创建一个 rails 项目并在gemfile中添加特定版本的 gem 并在另一个项目中添加另一个版本时,您可以毫无问题地同时拥有这两个版本

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

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