如何使用捆绑器重新安装宝石 [英] How to reinstall a gem using bundler

查看:85
本文介绍了如何使用捆绑器重新安装宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个 bundle show 并获得了一个gem目录的完整路径。



不幸的是,我删除了该目录使用 rm -r gem_path 。然后我的导轨应用程序不再工作了。如果我尝试启动服务器或启动rails控制台,它会输出以下错误:


< class:Application> :未初始化的常量 MyAPP :: Application :: Gem (NameError)

我应该做些什么来恢复它?

我试过 bundle install bundle update ,希望强制该包搜索该宝石并将其重新安装,但无效。



我也尝试删除 Gemfile.lock 并运行 bundle install 。没有任何变化,同样的错误。



有问题的宝石是 标记为

解决方案

首先,我做了一个 gem q --L gem query --local 的快捷键。它为我输出安装的所有本地gem。

  actionmailer(3.2.8,3.2.6,3.2.1,3.1。 0)
actionpack(3.2.8,3.2.6,3.2.1,3.1.0)
activemodel(3.2.8,3.2.6,3.2.1,3.1.0)
activerecord(3.2.8,3.2.6,3.2.1,3.1.0)
activeresource(3.2.8,3.2.6,3.2.1,3.1.0)
activesupport(3.2.8, (2.3.3)
...
act-as-taggable-on $ p>

然后,按照DVG的建议,我使用正确的名称卸载了gem gem uninstall acts-as-taggable-on 并运行 bundle install 。之后,我再次可以 rails c rails s


I did a bundle show and get the complete path to a gem directory.

Unfortunately, I removed the directory using rm -r gem_path. Then my rails app isn't working anymore. If I try start server or start rails console it outputs the following error:

<class:Application>: uninitialized constant MyAPP::Application::Gem (NameError)

What should I do to have it back?

I tried bundle install or bundle update in hope of forcing the bundle to search the gem and install it back, but didn't work.

I also tried delete the Gemfile.lock and run bundle install. Nothing changed, same error.

The gem in question is Act as taggable on.

解决方案

First I did a gem q --L, the shortcut for gem query --local. It outputs me the all the local gems installed.

actionmailer (3.2.8, 3.2.6, 3.2.1, 3.1.0)
actionpack (3.2.8, 3.2.6, 3.2.1, 3.1.0)
activemodel (3.2.8, 3.2.6, 3.2.1, 3.1.0)
activerecord (3.2.8, 3.2.6, 3.2.1, 3.1.0)
activeresource (3.2.8, 3.2.6, 3.2.1, 3.1.0)
activesupport (3.2.8, 3.2.6, 3.2.1, 3.1.0)
acts-as-taggable-on (2.3.3)
...

And then, following DVG advice, I uninstalled the gem using its correct name gem uninstall acts-as-taggable-on and ran bundle install. After that I was able to rails c or rails s again without any problem.

这篇关于如何使用捆绑器重新安装宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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