2011-02-08 4 views
6

Ho appena aggiornato il mio box Windows 2008 Server x64 a Rubygems 1.5.0 e ora non riesco a creare un gioiello usando le attività di rake (rake clobber build) fornite da Gemcutter. Ottengo il seguente errore:GemCutter rake build ora getta "metodo non definito 'write' per # <Syck :: Emitter: ...." dopo l'aggiornamento a rubygems 1.5.0 su ruby ​​1.9.2 su Windows

rake aborted! 
undefined method `write' for #<Syck::Emitter:0x37dda38> 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:17:in `end_document' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:17:in `visit_Psych_Nodes_Document' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/visitor.rb:10:in `accept' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `block in visit_Psych_Nodes_Stream' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `each' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `visit_Psych_Nodes_Stream' 
C:/Ruby192/lib/ruby/1.9.1/psych/visitors/visitor.rb:11:in `accept' 
C:/Ruby192/lib/ruby/1.9.1/psych/nodes/node.rb:36:in `to_yaml' 
C:/Ruby192/lib/ruby/1.9.1/psych.rb:166:in `dump' 
C:/Ruby192/lib/ruby/1.9.1/psych/core_ext.rb:13:in `psych_to_yaml' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `node_export' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `add' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `encode_with' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:727:in `block (2 levels) in to_yaml' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:726:in `map' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:726:in `block in to_yaml' 
C:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `call' 
C:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `emit' 
C:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `quick_emit' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:725:in `to_yaml' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:78:in `block (2 levels) in write_package' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:73:in `block (3 levels) in add_gem_contents' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_writer.rb:83:in `new' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:67:in `block (2 levels) in add_gem_contents' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:65:in `wrap' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:65:in `block in add_gem_contents' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_writer.rb:113:in `add_file' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:63:in `add_gem_contents' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:31:in `open' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package.rb:68:in `open' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:77:in `block in write_package' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:76:in `open' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:76:in `write_package' 
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:39:in `build' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/build_gem.rb:16:in `run' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler.rb:87:in `build_gem' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/tasks.rb:84:in `block in define' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain' 
C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>' 
C:/Ruby192/bin/rake:19:in `load' 
C:/Ruby192/bin/rake:19:in `<main>' 

basato sull'utilizzo di un fascio contenente:

Using rake (0.8.7) 
Using bundler (1.0.10) 
Using diff-lcs (1.1.2) 
Using git (1.2.5) 
Using jeweler (1.5.1) 
Using json (1.5.1) 
Using rcov (0.9.9) 
Using rspec-core (2.1.0) 
Using rspec-expectations (2.1.0) 
Using rspec-mocks (2.1.0) 
Using rspec (2.1.0) 
Using syntax (1.0.0) 
Using systemu (1.2.0) 
Using win32console (1.3.0) 

e le seguenti gemme installate nel sistema

activemodel (3.0.3, 3.0.1) 
activerecord (3.0.3, 3.0.1) 
activerecord-sqlserver-adapter (3.0.9, 3.0.6, 3.0.5) 
activesupport (3.0.3, 3.0.1) 
archive-tar-minitar (0.5.2) 
arel (2.0.7, 2.0.3, 1.0.1) 
builder (3.0.0, 2.1.2) 
bundler (1.0.10, 1.0.7) 
capistrano (2.5.19) 
capistrano_winrm (0.0.1) 
capybara (0.4.1.1, 0.4.0) 
celerity (0.8.7, 0.8.6) 
childprocess (0.1.6) 
color (1.4.1) 
columnize (0.3.2) 
cucumber (0.10.0, 0.9.4) 
culerity (0.2.15, 0.2.13) 
dbi (0.4.5) 
deprecated (3.0.0) 
diff-lcs (1.1.2) 
ffi (1.0.5 x86-mingw32, 1.0.4 x86-mingw32, 0.6.3 x86-mingw32) 
gemcutter (0.6.1) 
gherkin (2.3.3 x86-mingw32, 2.2.9 x86-mingw32) 
git (1.2.5) 
handsoap (1.1.8, 1.1.7) 
highline (1.6.1) 
hoe (2.9.1, 2.8.0) 
httpclient (2.1.6.1, 2.1.6) 
i18n (0.5.0, 0.4.2) 
ironruby-dbi (0.1.0) 
jeweler (1.5.2, 1.5.1) 
json (1.5.1 x86-mingw32, 1.4.6 x86-mingw32) 
json_pure (1.5.1, 1.4.6) 
justeat (0.1.0, 0.0.2) 
linecache19 (0.5.11) 
macaddr (1.0.0) 
mime-types (1.16) 
minitest (2.0.2, 1.6.0) 
mssqlclient (0.1.0) 
net-scp (1.0.4) 
net-sftp (2.0.5) 
net-ssh (2.1.0, 2.0.23) 
net-ssh-gateway (1.0.1) 
net-ssh-multi (1.0.1) 
net-ssh-shell (0.1.0) 
nokogiri (1.4.4.1 x86-mingw32) 
open4 (1.0.1) 
Platform (0.4.0) 
popen4 (0.1.2) 
rack (1.2.1) 
rack-test (0.5.7, 0.5.6) 
rake (0.8.7) 
rake-dotnet (1.0.2, 1.0.1, 0.2.2, 0.2.1, 0.2.0) 
rake-remote_task (2.0.2) 
rcov (0.9.9) 
rdiscount (1.6.8, 1.6.5) 
rdoc (3.5.3, 3.1, 2.5.8) 
rdoc-data (2.5.3) 
rspec (2.5.0, 2.3.0, 2.1.0, 2.0.1) 
rspec-core (2.5.1, 2.3.1, 2.1.0, 2.0.1) 
rspec-expectations (2.5.0, 2.3.0, 2.1.0, 2.0.1) 
rspec-mocks (2.5.0, 2.3.0, 2.1.0, 2.0.1) 
ruby-debug-base19 (0.11.24) 
ruby-debug-ide (0.4.16) 
ruby-odbc (0.99994, 0.99993, 0.99992) 
ruby_core_source (0.1.4) 
rubyforge (2.0.4) 
rubygems-update (1.5.0) 
rubyntlm (0.1.1) 
rubyzip (0.9.4) 
selenium-webdriver (0.1.2) 
syntax (1.0.0) 
systemu (1.2.0) 
term-ansicolor (1.0.5) 
trollop (1.16.2) 
tzinfo (0.3.24, 0.3.23) 
uuid (2.3.1) 
vlad (2.1.0) 
webrat (0.7.3, 0.7.2) 
win32-api (1.4.8 x86-mingw32, 1.4.7 x86-mingw32) 
win32-process (0.6.5) 
win32console (1.3.0 x86-mingw32) 
windows-api (0.4.0) 
windows-pr (1.1.3, 1.1.2) 
winrm (0.0.6) 
xpath (0.1.3, 0.1.2) 
+0

Ho risolto il problema effettuando il downgrade della versione dei rubygems a 1.3.7 nel frattempo. –

+0

Ecco un problema GitHub per il problema: https://github.com/carlhuda/bundler/issues/1239 –

risposta

20

Aggiornamento: Ci sono report in #1239 che l'aggiornamento a uno dei due bundler 1.0.21 o 1.1 potrebbe risolvere il problema. (Grazie a forforf per il puntatore!)

gem install bundler 

Questo è un bug noto (#1239) in bundler. La soluzione alternativa di Larsch per aggiungere require 'psych' nella parte superiore del Rakefile non è stata di aiuto per il mio progetto Rails (per qualsiasi ragione - semplicemente non ha cambiato nulla), ma l'impostazione RUBYOPT='-rpsych' come soluzione alternativa, così, ha risolto il problema:

RUBYOPT='-rpsych' bundle install 

(Grazie a Moro per pointing this out.)

sembra solo essere necessario per l'installazione e l'aggiornamento. L'applicazione stessa (ad esempio chiamata rake ecc., Anche con bundle exec) dovrebbe continuare a funzionare senza impostare RUBYOPT.


per lo sfondo, il motivo per cui è sufficiente richiedere il modulo psych fa la differenza sembra essere questo: YAML automatically utilizza il (vecchio) biblioteca syck, a meno che non Psych viene caricato al momento è richiesto YAML, nel qual caso usa Psych. Questo tipo di comportamento implicito, ovviamente, causa a lot of trouble, incluso il problema che vediamo qui.

+0

Si stava verificando un problema con una macchina windows di amici e utilizzando gemme che avevano: git => 'git: // ... 'fonti ... Non capisco perché .. ma ha funzionato! Grazie! –

+0

Un nuovo aggiornamento di bundler mi ha risolto il problema: 'gem install bundler -v1.0.21.rc'. Trovato tramite [thread di bug # 1239] (https://github.com/carlhuda/bundler/issues/1239). – forforf

+0

@forforf: Grazie! 1.0.21.rc non ha aiutato per me, ma 1.1.rc lo ha fatto. Ho aggiornato la risposta. –

1

avuto un problema simile su debian. Il ripristino di una versione precedente di bundler (1.0.9) anziché 1.0.10 ha risolto il problema.

7

This Hoe bug report descrive un work-around: Aggiungere richiede "psych" prima di qualsiasi altra cosa nel Rakefile. Per me va bene.

1

Ho riscontrato questo problema durante il tentativo di eseguire un'app di rotaie con Puma come server. La risposta è risultata essere ciò che le persone stavano dicendo, ad esempio, se non specificato, Ruby tenterà di usare syck (il vecchio parser yaml) invece di psych (il nuovo parser yaml). Ho dovuto modificare il file config/boot.rb con le seguenti righe:

require 'psych' 
YAML::ENGINE.yamler = 'psych' 

per costringerlo a smettere di usare syck e passare a psych. Dopo che tutto ha funzionato.