gem安装坏了?

发布于 2024-12-27 11:01:22 字数 1255 浏览 1 评论 0原文

我面临着一个以前从未遇到过的问题。有一天,当我进入 Sinatra 中的一个 ruby​​ 项目并进行捆绑安装时,我收到了此错误:

/Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)

奇怪,我想并继续输入

gem list

,然后我看到:

bundler (1.0.21, 1.0.2)

所以有捆绑器。然后,在尝试卸载捆绑程序并重新安装,将 ruby​​ -v 与 rvm 切换后,我尝试运行我拥有的任何其他 gem,例如rails。所以我运行了rails s和bam,我得到了与bundler相同的错误:

 /Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in`report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

发生了什么事?然后我对所有宝石尝试了同样的操作,并且都给出了相同的错误。这和rvm有关系吗?我似乎不记得最近几天做了任何不寻常的事情会导致这种情况。我所做的唯一一件事就是使用 Oh My ZSH 切换到 ZShell,但这与此无关。可能是什么问题?是否应该完全卸载 rvm 并重新安装它,然后再次添加我的 ruby​​ -v ?我的环境是 Mac OS X Lion。提前致谢。

编辑:

我现在可以开始了。我切换到 oh my zsh 确实是导致问题的原因。我找到答案的地方在这里: https://stackoverflow.com/a/4755696/434299

基本上是什么您需要做的是在您的

~/.zshrc

添加此行:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 

将rvm加载到shell会话中。问题解决了!感谢菲利克斯·拉贝为我指明了正确的方向。

I'm facing a problem I have never had before. The other day when I was going into a ruby project of mine that is in Sinatra and went to do a bundle install I got this error:

/Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)

Odd I thought and went ahead typing

gem list

and there I saw:

bundler (1.0.21, 1.0.2)

So there bundler is. Then after trying uninstalling bundler and reinstalling, switching ruby -v with rvm I tried running any other gem I have, like rails. So I ran rails s and bam, I got the same error as with bundler:

 /Users/me/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in`report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

What is going on? I then tried the same thing with all my gems and all gives the same error. Has this anything to do with rvm? I can't seem to remeber doing anything out of the ordinary these last couple of days that can have caused this. The only thing I have done is switching to ZShell with Oh My ZSH, but that can't have anything to do with this. What can be the problem? Should uninstall rvm altogether and reinstall it and then add the ruby -v I have again? My environment is Mac OS X Lion. Thanks in advance.

EDIT:

I now got it to roll. My switch to oh my zsh was indeed what was causing the problem. Amongst the places where I found the answer was here: https://stackoverflow.com/a/4755696/434299

Basically what you need to do is in your

~/.zshrc

Add this line:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 

Which loads rvm into a shell session. Problem solved! Thanks to Felix Rabe for pointing me in the right direction.

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

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

发布评论

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

评论(2

比忠 2025-01-03 11:01:22

您将“Oh my ZSH”与 RVM 一起使用可能是原因。我在 google 上搜索 zsh rvm 并找到 http://beginrescueend.com/integration/zsh,底部写着:

如果您想使用 oh my zsh,请务必不要使用捆绑包。
如果 rvm 应该照顾好一切,无论如何这都会为你做。

(从我上面的评论中复制以获得“可接受的”答案。)

Your use of "Oh my ZSH" together with RVM could be the cause. I googled for zsh rvm and found http://beginrescueend.com/integration/zsh, where it says at the bottom:

If you want to use oh my zsh be sure not to use the bundler package.
If rvm should take care of everything this would do for you anyways.

(Copied from my comment above to get an "accept-able" answer.)

戏蝶舞 2025-01-03 11:01:22

我以不同的方式修复了这个问题。

我的 ~/.zshrc 现在有这一行插件,它解决了我遇到的问题:

plugins=(git bundler brew git osx ruby​​ zsh-syntax-highlighting)

这与 Ryan Bates 此处使用的配置类似:http://railscasts.com/episodes/308-oh-my-zsh

I fixed this differently.

My ~/.zshrc now has this line for the plugins and it solved the issues i was having:

plugins=(git bundler brew git osx ruby zsh-syntax-highlighting)

This is similar to the config that Ryan Bates uses here: http://railscasts.com/episodes/308-oh-my-zsh

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