gemspec中的date格式指定无效
当我尝试在Windows中使用gem时,出现以下错误,我也提到了这个stackoverflow后 ,更新了rubygems和rails。 但是什么都不能解决问题。
以下是完整的错误,
D:\> gem env
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/tilt-1.3.3.gemspec]:规范中的无效date格式:“2011-08-25 00:00:00
.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/execjs-1.2.4.gemspec]:规范中无效的date格式:“2011-08-03 00:00:
00.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/temple-0.3.3.gemspec]:规范中无效的date格式:“2011-08-26 00:00:
00.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/guard-0.6.3.gemspec]:规范中的date格式无效:“2011-09-01 00:00:0
0.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/guard-livereload-0.3.1.gemspec]:规范中的无效date格式:“2011-09
-01 00:00:00.000000000Z“
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/rack-cache-1.0.3.gemspec]:规范中无效的date格式:“2011-08-27 00
:00:00.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/tilt-1.3.3.gemspec]:规范中的无效date格式:“2011-08-25 00:00:00
.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/execjs-1.2.4.gemspec]:规范中无效的date格式:“2011-08-03 00:00:
00.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/temple-0.3.3.gemspec]:规范中无效的date格式:“2011-08-26 00:00:
00.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/guard-0.6.3.gemspec]:规范中的date格式无效:“2011-09-01 00:00:0
0.000000000Z”
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/guard-livereload-0.3.1.gemspec]:规范中的无效date格式:“2011-09
-01 00:00:00.000000000Z“
[D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效
/rack-cache-1.0.3.gemspec]:规范中无效的date格式:“2011-08-27 00
:00:00.000000000Z”
RubyGems环境:
- RUBYGEMS版本:1.7.2
- RUBY VERSION:1.8.7(2011-06-30 patchlevel 352)[i386-mingw32]
- 安装目录:D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8
- RUBY EXECUTABLE:D:/RailsInstaller/Ruby1.8.7/bin/ruby.exe
- 可执行的目录:D:/RailsInstaller/Ruby1.8.7/bin
- RUBYGEMS平台:
- ruby
- x86-mingw32
- 创业板path:
- D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8
- C:/ Documents and Settings / jeygokul / .gem / ruby / 1.8
- 创业板configuration:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- 远程来源:
- http://rubygems.org/
我已经通过将RubyGems升级到1.8.10来解决这个问题
gem update --system
编辑:你也可以尝试(由ZeissSbuild议)
gem install rubygems-update update_rubygems
最终的解决scheme是这样的:
在Ruby目录中search“spec”文件:* C:\ Ruby187 \ lib \ ruby \ gems \ 1.8 \ specifications *
如果gemspec文件包含这样的内容:s.date =%q {2011-10-13 00:00:00.000000000Z }然后删除00:00:00.000000000Z部分:s.date =%q {2011-10- 13}
保存这些gemspec文件后,问题就解决了。
这些解决scheme都不适合我。 为了解决这个问题,我删除了所提到的目录(some / path / to / specification /)的所有内容,然后安装了我需要的gem(实际上,Bundler然后捆绑安装)。
除了运行gem update --system我还使用gem install <gem with bad gemspec>在每个项目gem env上报告为坏。 这清理了我的机器上的错误。
正如迈克尔在评论中所说:
gem pristine --all
尝试在Ubuntu 11.10上安装GEM时遇到同样的问题。
Invalid gemspec in [/var/lib/gems/1.8/specifications/svn2git-2.1.2.gemspec]: invalid date format in specification: "2011-12-28 00:00:00.000000000Z"
以上选项对我不起作用。 gem env报告如下:
RubyGems Environment: - RUBYGEMS VERSION: 1.7.2 - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
所以我推测这个问题是由于我需要安装一个新版本的RubyGems。
发布gem update --system发出以下警告:
ERROR: gem update --system is disabled on Debian, because it will overwrite the content of the rubygems Debian package, and might break your Debian system in subtle ways. The Debian-supported way to update rubygems is through apt-get, using Debian official repositories. If you really know what you are doing, you can still update rubygems by setting the REALLY_GEM_UPDATE_SYSTEM environment variable, but please remember that this is completely unsupported by Debian.
但是,我终于能够通过发布以下内容来将rubygems更新到1.8.15:
sudo gem install rubygems-update && update_rubygems
一切工作后,祝你好运! 🙂
[/var/lib/gems/1.8/specifications/chronic-0.6.4.gemspec]中的gemspec无效:规范中的date格式无效:“2011-09-09 00:00:00.000000000Z”
对这种问题的简单解决方法是导航到文件..例如。
第1步。cd /var/lib/gems/1.8/specifications
步骤2.在你select的编辑器中打开文件(chronic-0.6.4.gemspec)…(gedit chronic-0.6.4.gemspec)
第3步。将s.date =%q {2011-10-13 00:00:00.000000000Z}更改为s.date =%q {2011-10-13}
干杯:)
升级到10.10后,我在Ubuntu上遇到了同样的问题。 以上都没有为我工作。 我不得不从http://rubygems.org/pages/download安装update_rubygems脚本并运行一次。; 后缀一切工作。
我已经解决了这个问题“无效date甲酸盐规范”,通过改变D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications/tilt-1.3.3.gemspec相应的行,通过把s.date = Time.now而不是s.date =“2011-08-25 00:00:00.000000000Z”同样可以使用其他文件。
我有太多的gem一个一个地修复,并尝试update_rubygems和gem pristine --all仍然没有运气。
所以我使用rvm clear gemset来删除gemspec错误的所有gem。 执行bundle install重新安装所有的gem,中提琴!
cd vendor/bundle/ruby/1.9.x/specifications sed -i 's/ 00\:00\:00.000000000Z//g' *
通过运行gem update --system解决,然后gem update 。
这些答案中提到的各种解决scheme并不适合我。 什么工作是重新安装有问题的gem的具体版本。 在你的情况下,会看起来像:
gem install tilt -v 1.3.3 gem install execjs -v 1.2.4 gem install temple -v 0.3.3 gem install guard -v 0.6.3 gem install guard-livereload -v 0.3.1 gem install rack-cache -v 1.0.3
我认为gem pristine xxx yyy zzz或者gem pristine --all可能不会永远(永远)出现在gem库中,而gem install xxx -v vrm却可以。
无论如何,重新安装的gem的违规版本为我工作,虽然这是乏味的…
rvm gemset clear ,然后bundle install为我工作!
“gem install rubygems-update”,“update_rubygems”,然后是“gem pristine -all”,这个组合就是解决了以前没有列出的问题的问题。
在我的情况下,引用的gem版本甚至没有安装。 我有那些gem,但不是那些gemspecs造成错误的版本。 所以,我刚删除了/path/to/specifications/offending-XYZZ.gemspec文件。
这不是一个真正的答案,但如果有人想挖掘更多,我发现这个gemspec规范在这里: http ://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html(向下滚动到date=date()和点击显示来源):
@date = case date when String then if %r\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then Time.utc($1.to_i, $2.to_i, $3.to_i) else raise(Gem::InvalidSpecificationException, "invalid date format in specification: #{date.inspect}") end when Time, Date then Time.utc(date.year, date.month, date.day) else TODAY end
所以我想这是parsinggemspec的代码,它看起来像显示错误不符合这个文件的date格式。
我所做的只是手动修复上面build议的那些违规的gemspecs(将date更改为“yyyy-mm-dd”,它适用于我。
所有rubygem规格,我有这个问题也有一个线
s.rubygems_version =%q {1.3.5}
所以我猜这些只是古老的gem? 而那些%q {…}又是怎么回事呢?
如果你在Ubuntu 11.04上有这个错误,我的解决scheme是下面的命令行:
$ sudo apt-get install ruby1.9.1
这样做后,你不会得到date错误。