从Gemfile中删除宝石后该怎么办? [英] What to do after removing a gem from the Gemfile?

查看:112
本文介绍了从Gemfile中删除宝石后该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Gemfile中删除了一个gem'mygem',但现在我意识到它仍已安装。

I removed a gem 'mygem' from the Gemfile, but just now I realized it's still installed.

所以我如何告诉捆绑软件重新扫描Gemfile并更新Gemfile.lock,更新每个宝石吗?

So how do I tell bundler to rescan the Gemfile and update Gemfile.lock, without updating every gem?

来自php,这是我用来执行此操作的方式:作曲家什么也没更新

Coming from php, this is how I'm used to do this: composer update nothing. Is there an equivalent for bundler?

推荐答案

您可以只运行 bundle 捆绑安装以根据您的Gemfile安装gem。这将从您的Gemfile.lock文件中删除 mygem 的实例。但是,它不会从系统中删除gem。为此,请运行 gem卸载mygem

You can run just bundle or bundle install to install gems based on your Gemfile. That will remove the instance of mygem from your Gemfile.lock file. It will not, however, remove the gem from your system. To do that, run gem uninstall mygem.

不完全相关,但仍然有用:

Not completely related, but still helpful:


  • 捆绑包已过期会向您显示未安装最新版本的宝石。请勿将此列表与捆绑在一起–在最新版本中未包含gem的情况相当普遍,因为某些gems已作为依赖项安装,并且一个宝石可能需要另一个宝石的旧版本。

  • 捆绑升级mygem 会升级 just gem,并将其依赖关系更新为最新。这意味着可能还会升级或安装其他宝石。

  • 您可以搜索 RubyGems 查看gem在每个版本中的依赖关系。作为gem用户,您只需要关心gem页面底部的运行时依赖项列表即可。

  • bundle outdated will show you the gems that aren't on the latest version. Don't get too tied up with this list - it's fairly common to have gems that aren't on the latest version, because some gems are installed as dependencies & one gem might be requiring an older version of another gem.
  • bundle upgrade mygem will upgrade just that gem, and will bring its dependencies up to date. That means that other gems might be upgraded or installed as well.
  • You can search RubyGems to see a gem's dependencies across each of its versions. As a gem user, you'll only need to be concerned with the 'Runtime Dependencies' list at the bottom of the gem's page.

这篇关于从Gemfile中删除宝石后该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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