宝石和/或Ruby on Rails突然崩溃了,谁知道发生了什么? [英] gem and/or Ruby on Rails broke all of a sudden, anyone know what happened?

查看:73
本文介绍了宝石和/或Ruby on Rails突然崩溃了,谁知道发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个曾经工作的Ruby on Rails应用程序。我在一个月左右没有使用它,但是今天试着用 rails s 来启动它,并且得到了下面的错误 - 事实上,当我遇到这个错误时尝试 rails -h rails -v 甚至 gem -h sudo gem update --system 或任何与 gem 有关的任何内容。

 注:不推荐使用Gem :: Specification#default_executable =。它将在2011年10月1日或之后删除。 
Gem :: Specification#default_executable =从/Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.2.gemspec:11调用。
[/Library/Ruby/Gems/1.8/specifications/tilt-1.3.3.gemspec]中的gemspec无效:规范中的日期格式无效:2011-08-25 00:00:00.000000000Z
注意:不推荐使用Gem :: Specification#default_executable =。它将在2011年10月1日或之后删除。
Gem :: Specification#default_executable =从/Users/me/.gem/ruby/1.8/specifications/json-1.5.1.gemspec:10调用。
/Library/Ruby/Site/1.8/rubygems/specification.rb:277:in`_resort!':未定义方法`name'为nil:NilClass(NoMethodError)$ b $ from / Library / Ruby / Site /1.8/rubygems/specification.rb:276:in`sort!'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:276:in`_resort!'$ b $ from / Library /Ruby/Site/1.8/rubygems/specification.rb:270:in`_all'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:402:in`each'
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in`find_all'
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in`matching_specs'
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:238:in`to_specs'
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:in`to_spec'$ b / b / from /Library/Ruby/Site/1.8/rubygems.rb:1182:in`gem'
from / usr / bin / rails:18

任何人都知道发生了什么以及如何解决它?我怎样才能卸载它并重新安装它(不卸载我的操作系统,真的很吸引人)

通过运行清理所有已安装的gem

$ $ p $ r $ r $ r $ r $ -rf〜/ .gems $ b $ sudo rm -rf / Library / Ruby / Gems / *

在此之后 gem list 应该列出没有宝石。然后运行

  sudo gem update --system 

确保Ruby Gems处于最新版本。您将不得不重新安装所有的宝石。 (可能 gem install bundler 然后是 bundle install )。



<顺便说一下,您应该查看 rbenv rvm 来管理Ruby版本,并将所有开发宝石与系统Ruby分开。


I had a Ruby on Rails app that used to work. I hadn't used it in a month or so, but then tried starting it up today with rails s and got the following error—in fact, I get this error when I try rails -h or rails -v or even gem -h or sudo gem update --system or anything having to do with gem.

NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.8.2.gemspec:11.
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/me/.gem/ruby/1.8/specifications/json-1.5.1.gemspec:10.
/Library/Ruby/Site/1.8/rubygems/specification.rb:277:in `_resort!': undefined method `name' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:276:in `sort!'
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:276:in `_resort!'
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:270:in `_all'
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:402:in `each'
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in `find_all'
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:216:in `matching_specs'
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:238:in `to_specs'
    from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:in `to_spec'
    from /Library/Ruby/Site/1.8/rubygems.rb:1182:in `gem'
    from /usr/bin/rails:18

Anyone know what's going on and how to fix it? How can I uninstall it all and reinstall it (without uninstalling my OS, man that would really suck)

解决方案

I'd try cleaning out all your installed gems by running

rm -rf ~/.gems
sudo rm -rf /Library/Ruby/Gems/*

After this gem list should list no gems. Then run

sudo gem update --system

to ensure Ruby Gems is at the latest version. You'll then have to reinstall all your gems. (Probably gem install bundler followed by bundle install).

By the way, you should check out rbenv or rvm for managing Ruby versions and keeping all your development gems separate from the system Ruby.

这篇关于宝石和/或Ruby on Rails突然崩溃了,谁知道发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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