简体   繁体   English

Rails服务器和控制台无法启动:“无法加载此类文件 - zip / zip(LoadError)”

[英]Rails server and console fails to start : “cannot load such file — zip/zip (LoadError)”

My development server has worked fine for years. 我的开发服务器已经运行多年了。 Today, perhaps due to some update in bundler version, both server and console have started to fail when launched. 今天,也许是由于捆绑器版本的一些更新,服务器和控制台在启动时都已经开始失败。

I really have not a clue of what might be wrong. 我真的不知道可能出现什么问题。 It seems that some gems have been updated: 似乎有些宝石已经更新:

diff --git a/Gemfile.lock b/Gemfile.lock
index 2ee3882..a931a88 100644
@@ -33,9 +33,9 @@ GEM
       activerecord (>= 3.0)
     addressable (2.4.0)
     afm (0.2.2)
-    airbrake (5.0.3)
+    airbrake (5.0.5)
       airbrake-ruby (~> 1.0)
-    airbrake-ruby (1.0.3)
+    airbrake-ruby (1.0.4)
     amoeba (3.0.0)
       activerecord (>= 3.2.6)
     arel (3.0.3)
@@ -60,7 +60,7 @@ GEM
       json (>= 1.7)
       mime-types (>= 1.16)
     chronic (0.10.2)
-    coderay (1.1.0)
+    coderay (1.1.1)
     coffee-rails (3.2.2)
       coffee-script (>= 2.2.0)
       railties (~> 3.2.0)
@@ -73,7 +73,7 @@ GEM
       i18n (>= 0.5.0)
       json
     debug_inspector (0.0.2)
-    devise (3.5.5)
+    devise (3.5.6)
       bcrypt (~> 3.0)
       orm_adapter (~> 0.1)
       railties (>= 3.2.6, < 5)
@@ -139,9 +139,9 @@ GEM
       actionpack (>= 3.1)
       less (~> 2.6.0)
     libv8 (3.16.14.13)
-    listen (3.0.5)
+    listen (3.0.6)
       rb-fsevent (>= 0.9.3)
-      rb-inotify (>= 0.9)
+      rb-inotify (>= 0.9.7)
     lumberjack (1.0.10)
     mail (2.4.4)
       i18n (>= 0.4.0)
@@ -155,7 +155,7 @@ GEM
     multiple_table_inheritance (0.2.1)
       activerecord (>= 3.0.0)
       activesupport (>= 3.0.0)
-    nenv (0.2.0)
+    nenv (0.3.0)
     nested_form (0.3.2)
     nokogiri (1.6.7.2)
       mini_portile2 (~> 2.0.0.rc2)
@@ -163,9 +163,9 @@ GEM
       nenv (~> 0.1)
       shellany (~> 0.0)
     orm_adapter (0.5.0)
-    pdf-reader (1.3.3)
+    pdf-reader (1.4.0)
       Ascii85 (~> 1.0.0)
-      afm (~> 0.2.0)
+      afm (~> 0.2.1)
       hashery (~> 2.0)
       ruby-rc4
       ttfunk
@@ -179,7 +179,7 @@ GEM
       method_source (~> 0.8.1)
       slop (~> 3.4)
     rack (1.4.7)
-    rack-cache (1.5.1)
+    rack-cache (1.6.1)
       rack (>= 0.4)
     rack-mini-profiler (0.9.8)
       rack (>= 1.1.3)
@@ -207,7 +207,7 @@ GEM
     raindrops (0.15.0)
     rake (10.5.0)
     rb-fsevent (0.9.7)
-    rb-inotify (0.9.5)
+    rb-inotify (0.9.7)
       ffi (>= 0.5.0)
     rdoc (3.12.2)
       json (~> 1.4)
@@ -230,7 +230,7 @@ GEM
       rspec-core (~> 3.4.0)
       rspec-expectations (~> 3.4.0)
       rspec-mocks (~> 3.4.0)
-    rspec-core (3.4.2)
+    rspec-core (3.4.3)
       rspec-support (~> 3.4.0)
     rspec-expectations (3.4.0)
       diff-lcs (>= 1.2.0, < 2.0)
@@ -238,7 +238,7 @@ GEM
     rspec-mocks (3.4.1)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.4.0)
-    rspec-rails (3.4.1)
+    rspec-rails (3.4.2)
       actionpack (>= 3.0, < 4.3)
       activesupport (>= 3.0, < 4.3)
       railties (>= 3.0, < 4.3)
@@ -248,7 +248,7 @@ GEM
       rspec-support (~> 3.4.0)
     rspec-support (3.4.1)
     ruby-rc4 (0.1.5)
-    rubyzip (1.1.7)
+    rubyzip (1.2.0)

Error message for both server and console: 服务器和控制台的错误消息:

/home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require': cannot load such file -- zip/zip (LoadError)
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
    from /home/javier/Workspace/e-nrg/config/application.rb:7:in `<top (required)>'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:39:in `require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:39:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Docs 文件

The Rubyzip interface has changed!!! Rubyzip界面已经改变了! No need to do require "zip/zip" and Zip prefix in class names removed. 无需执行“zip / zip”和删除类名中的Zip前缀。

If you have issues with any third-party gems that require an old version of rubyzip, you can use this workaround: 如果您遇到任何需要旧版rubyzip的第三方gem,您可以使用此解决方法:

gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version gem 'zip-zip' # will load compatibility for old rubyzip API. gem'rubyzip','> = 1.0.0'#将加载新的rubyzip版本gem'zip-zip'#将加载旧rubyzip API的兼容性。

So I assume "for years" means you'd have been using the old rubyzip api. 所以我认为“多年”意味着你一直在使用旧的rubyzip api。 So add the zip-zip gem and you should be fine. 所以添加zip-zip宝石,你应该没问题。

Add rb-readline in your Gemfile and try to run rails server. 在Gemfile中添加rb-readline并尝试运行rails server。 If it doesn't work do sudo apt-get install libreadline-dev and repeat the process. 如果它不起作用,请执行sudo apt-get install libreadline-dev并重复该过程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 LoadError: cannot load such file -- zip/zip when running any rails command after upgrade - LoadError: cannot load such file -- zip/zip when running any rails command after upgrade Rails服务器正常工作,Rails控制台无效。 `require&#39;:无法加载此类文件-捆绑程序/安装程序(LoadError)- - Rails server works, Rails console does not. `require': cannot load such file — bundler/setup (LoadError) - Rails 服务器和 Rails 控制台崩溃:要求&#39;:无法加载此类文件 -- 机架/保护 (LoadError) - Rails server and Rails console crash with: require': cannot load such file -- rack/protection (LoadError) 无法启动 Rails 服务器 -&gt; 无法加载此类文件 -- mysql2/mysql2 (LoadError) - cannot start rails server -> cannot load such file -- mysql2/mysql2 (LoadError) Rails 控制台:在“require”中:无法加载此类文件 — readline (LoadError) - Rails console: in `require': cannot load such file — readline (LoadError) zip / zip(LoadError) - 打破后卫或者导轨4.0 - zip/zip (LoadError) - Breaking guard or rails 4.0 Rails Server引发错误“无法加载此类文件” — sass / logger(LoadError) - `rails server` throws error “cannot load such file” — sass/logger (LoadError) rails服务器抛出`require&#39;:无法加载这样的文件 - bigdecimal / util(LoadError) - rails server throws `require': cannot load such file — bigdecimal/util (LoadError) Spork无法启动,没有要加载的文件— spork(LoadError) - Spork fails to start with no such file to load — spork (LoadError) rubyzip - 无法加载此类文件 - zip - rubyzip - cannot load such file — zip
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM