Invalid date format specification in gemspec

后端 未结 18 2036
野性不改
野性不改 2020-12-04 09:47

I am getting the following error when I try to use gems in windows, and I also referred to this stackoverflow post and updated rubygems and rails. But nothing could solve t

相关标签:
18条回答
  • 2020-12-04 10:09

    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?

    0 讨论(0)
  • 2020-12-04 10:12

    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.

    0 讨论(0)
  • 2020-12-04 10:17

    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.

    0 讨论(0)
  • 2020-12-04 10:18

    rvm gemset clear and then bundle install worked for me!

    0 讨论(0)
  • 2020-12-04 10:19

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

    0 讨论(0)
  • 2020-12-04 10:19

    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...

    0 讨论(0)
提交回复
热议问题