غريب محزم خطأ:tar_input.rb:49:في تهيئة':لا في gzip شكل (Zlib::GzipFile::خطأ) على حزمة حزمة

StackOverflow https://stackoverflow.com/questions/2494659

سؤال

أنا على الحصول على غريب محزم خطأ عند تشغيل

bundle pack

مع محزم 0.9.12

أي أفكار ؟ (انظر باسط أفضل تنسيق التعليمات البرمجية: http://pastie.org/881328 )

/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:63:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `loop'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:32:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package.rb:55:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in `from_io'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:115:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:32:in `from_cached_specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:23:in `application_cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:15:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:14:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:15:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:13:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:86:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:130:in `details'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:119:in `write_yml_lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:65:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:89:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:131:in `package'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `send'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `run'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:109
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `call'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `invoke'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:137:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/base.rb:378:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:124:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/bin/bundle:11
  from /opt/REE/bin/bundle:19:in `load'
  from /opt/REE/bin/bundle:19
هل كانت مفيدة؟

المحلول 2

للإجابة على سؤالي:

كان الإصلاح هو حذف جميع المحتويات من

vendor/cache

بعد ذلك عملت.

بوضوح حشرة الحزمة.

نصائح أخرى

كنت أواجه مشكلة مماثلة مع Bundle Upate (Bundler 1.0). أنا أستخدم RVM مع GEMSET لتطبيقي.

كان الحل لإزالة:

~/.rvm/gems/ree-1.8.7-2010.02@gemset-name/cache

ويزعم الأصلي المسألة الثابتة مع محزم 1.0.x, ولكن كان لا يزال نفس رسالة الخطأ (باستخدام 1.0.3).أنا إزالة جميع cache مجلدات ، بما في ذلك في RVM الدلائل المبينة في إجابات أخرى هنا-لا النرد.

اتضح عليك أيضا الحصول على هذا الخطأ إذا كان محزم لا يمكن حل واحدة من المصادر الخاصة بك (أي تلك التي يتم إرجاعها من قبل $ gem sources).حتى إذا كنت قائمة مصادر متعددة ، وسوف بينغ كل منهم ، و إذا أي المصدر هو سيء ، فإنه سوف يتلف مع هذا لا يوصف 'initialize': not in gzip format خطأ.

كما هو موضح في هذه التذكرة, هذا يمكن أن يكون بسبب شيء لا يمكن الوصول إليها مثل VPM أو شبكة محلية المصدر ، ولكن في الواقع أنا واجهت مشكلة بسبب شركتي جدار الحماية حظر rubygems.org.

مجرد تقديم هذه الإجابة آخر ممكن حل لتوضيح هذا الغموض رسالة الخطأ.

حدث لي للتو مع Bundler 0.9.26 و Rails3 Beta4. أطلقت

bundle package

الآن يعمل. ولكن إذا قمت بإزالة البائع/ذاكرة التخزين المؤقت ، فإن المشكلة تستمر.

كان له نفس الشيء ، تمت إزالته /bundler_gems /cache

على الرغم من أنني أقوم بتشغيل Bundler 1.0.0 ، إلا أنني ما زلت أضغط على هذا الخطأ. bundle install لم ينجح ، لكن الجري bundle package فعل.

rm -rf vendor/cache

bundle package

bundle install

bundle lock

إنه أمر مزعج بعض الشيء ... لا أعرف لماذا لا أستطيع فعل ذلك bundle install --relock

إذا كنت تستخدم Capistrano مع Bundler's require 'bundler/capistrano', ، دليل ذاكرة التخزين المؤقت في shared/bundle/ruby/1.8/cache.

ذهبت جميع آثار هذا الخطأ عندما قمت بالترقية إلى Bundler 1.0.x.

لقد قمت بحل هذه المشكلة في تطبيق Rails 3.1 عن طريق حذف ملفات الأحجار الكريمة المؤرشفة:

$ bundle -v
Bundler version 1.0.17
$ rm -f vendor/bundle/ruby/1.8/cache/*.gem

واجهت هذه المشكلة عند النشر ، لكنني لم أرغب في الإزالة vendor/cache من جيت.

بدلاً من ذلك ، انتهى بي الأمر بالقيام بذلك:

# deploy.rb
namespace :bundle do
  desc "Removes vendor/cache when NO_GEM_CACHE=1 is set. Resolves Zlib::GzipFile::Error (not in gzip format)."
  task :remove_cache do
    run "rm -fr #{release_path}/vendor/cache" if ENV['NO_GEM_CACHE'] == '1'
  end
end
before :'bundle:install', :'bundle:remove_cache'

كلما ظهر هذا الخطأ ببساطة:

cap deploy NO_GEM_CACHE=1
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top