developer tip

gemspec에서 유효하지 않은 날짜 형식 지정

optionbox 2020. 7. 28. 08:25
반응형

gemspec에서 유효하지 않은 날짜 형식 지정


Windows에서 gem을 사용하려고 할 때 다음 오류가 발생 하며이 stackoverflow 게시물을 참조 하고 rubygems 및 rails를 업데이트했습니다. 그러나 아무것도 문제를 해결할 수 없습니다.

다음은 완전한 오류입니다.

    D : \> 보석 환경
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/tilt-1.3.3.gemspec] : 사양의 잘못된 날짜 형식 : "2011-08-25 00:00:00
.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/execjs-1.2.4.gemspec] : 사양의 잘못된 날짜 형식 : "2011-08-03 00:00 :
00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/temple-0.3.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-08-26 00:00 :
00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/guard-0.6.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-09-01 00 : 00 : 0
0.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/guard-livereload-0.3.1.gemspec] : 사양의 잘못된 날짜 형식 : "2011-09
-01 00 : 00 : 00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/rack-cache-1.0.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-08-27 00
: 00 : 00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/tilt-1.3.3.gemspec] : 사양의 잘못된 날짜 형식 : "2011-08-25 00:00:00
.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/execjs-1.2.4.gemspec] : 사양의 잘못된 날짜 형식 : "2011-08-03 00:00 :
00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/temple-0.3.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-08-26 00:00 :
00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/guard-0.6.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-09-01 00 : 00 : 0
0.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/guard-livereload-0.3.1.gemspec] : 사양의 잘못된 날짜 형식 : "2011-09
-01 00 : 00 : 00.000000000Z "
[D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/ 사양의 잘못된 gemspec
/rack-cache-1.0.3.gemspec] : 사양에서 유효하지 않은 날짜 형식 : "2011-08-27 00
: 00 : 00.000000000Z "
RubyGems 환경 :
  -루비 엄 버전 : 1.7.2
  -루비 버전 : 1.8.7 (2011-06-30 패치 레벨 352) [i386-mingw32]
  -설치 디렉토리 : D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8
  -RUBY EXECUTABLE : D : /RailsInstaller/Ruby1.8.7/bin/ruby.exe
  -EXECUTABLE DIRECTORY : D : /RailsInstaller/Ruby1.8.7/bin
  -RUBYGEMS 플랫폼 :
    -루비
    -x86-mingw32
  -보석 경로 :
     -D : /RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8
     -C : / 문서 및 설정 /jeygokul/.gem/ruby/1.8
  -보석 구성 :
     -: update_sources => true
     -: verbose => true
     -: 벤치 마크 => 거짓
     -: backtrace => 거짓
     -: bulk_threshold => 1000
  -원격 소스 :
     -http://rubygems.org/

RubyGems를 1.8.10 으로 업그레이드 하여이 문제를 해결했습니다.

gem update --system

편집 : 시도 할 수도 있습니다 (ZeissS가 제안한대로)

gem install rubygems-update
update_rubygems

궁극적 인 해결책은 다음과 같습니다.

Search "spec" files in your Ruby directory: *C:\Ruby187\lib\ruby\gems\1.8\specifications*

If a gemspec file contains something like this: s.date = %q{2011-10-13 00:00:00.000000000Z} Then delete the 00:00:00.000000000Z part: s.date = %q{2011-10-13}

After saving those gemspec files, the problem is solved.


None of these solutions worked for me. To fix it, I removed all the content of the mentioned directory (some/path/to/specification/) then I installed the gems I need (actually, Bundler then bundle install).


In addition to running gem update --system I used gem install <gem with bad gemspec> on each of the item gem env reported as bad. This cleaned up the errors on my machine.


As Michael said in the comment:

gem pristine --all

Had the same problem when trying to install a GEM on Ubuntu 11.10.

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"

The above options did not work for me. gem env reported the following:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.7.2
  - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

So I presumed this problem was due to the fact I required a newer version of RubyGems installed.

Issuing gem update --system yeilded the following warning:

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.

However I was finally able to update rubygems to 1.8.15 by issuing:

sudo gem install rubygems-update && update_rubygems

Everything worked after that, good luck! :)


Invalid gemspec in [/var/lib/gems/1.8/specifications/chronic-0.6.4.gemspec]: invalid date format in specification: "2011-09-09 00:00:00.000000000Z"

The simple fix to such kind of problem is to navigate to the file.. for eg.

Step 1. cd /var/lib/gems/1.8/specifications
step 2. open the file(chronic-0.6.4.gemspec) in editor of ur choice... (gedit chronic-0.6.4.gemspec)
step 3. change the s.date = %q{2011-10-13 00:00:00.000000000Z} to s.date = %q{2011-10-13}

Cheers :)


I just had the same problem on my ubuntu after upgrading to 10.10. None of the above worked for me. I had to install the update_rubygems script from http://rubygems.org/pages/download and run it once. Afterwords everything worked.


I have fixed this issue 'invalid date formate specification' by, changing the corresponding line in D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications/tilt-1.3.3.gemspec by putting s.date =Time.now instead of s.date = "2011-08-25 00:00:00.000000000Z" The same can be use the other files too.


I've too many gems to fix one by one, and try both update_rubygems and gem pristine --all still no luck.

So I use rvm clear gemset to remove all gems with wrong gemspec. Execute bundle install to reinstall all the gems, and Viola!


cd vendor/bundle/ruby/1.9.x/specifications
sed -i 's/ 00\:00\:00.000000000Z//g' *

Solved by running gem update --system then gem update.


The various solutions noted in these answers did not work for me. What did work was re-installing the specific versions of the offending gem's. In your case that would of looked like:

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

I think that gem pristine xxx yyy zzz or gem pristine --all might not be going out always (ever?) to the gem repositories whereas gem install xxx -v v.r.m does.

Anyway, re-installing the offending versions of the gems worked for me, although it was tedious...


rvm gemset clear and then bundle install worked for me!


"gem install rubygems-update", "update_rubygems", then "gem pristine --all" is the combination that solved the problem for me after none of the previously listed ones worked.


In my case, the referenced gem versions weren't even installed. I had those gems, but not the versions who's gemspecs were causing the error. So, I just deleted each of the /path/to/specifications/offending-X.Y.ZZ.gemspec files.


This is not really an answer but if somebody feels like digging more I found this gemspec spec here: http://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html (scroll down to date=date() and click to show source):

@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

So I guess this is the code that parses that gemspec, and it just looks like the date format that are in the files that show errors don't conform to this.

What I did was to just manually fix those offending gemspecs as suggested above (changing the dates to "yyyy-mm-dd", it works for me.

All the rubygem specs I had that had this problem also has a line

s.rubygems_version = %q{1.3.5}

So I'm guessing these are just old gems? And what's with those %q{...} anyway?


If you had this error on Ubuntu 11.04 my solution was the following command lines:

$ sudo apt-get install ruby1.9.1

After doing this you will not get the date error.

참고URL : https://stackoverflow.com/questions/7290575/invalid-date-format-specification-in-gemspec

반응형