2016-05-24 38 views
9

Sto usando ruby version 1.9.3 e ottenere l'errore quando inizio thin serverpdf-writer-1.1.8/lib/pdf/writer.rb: 712: non valida multibyte char (US-ASCII)

/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.12.4/lib/bundler/runtime.rb:100:in `require': /usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII) (SyntaxError) 
/usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII) 
/usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: syntax error, unexpected $end, expecting keyword_end 
    content = "%PDF-#{@version}\n%âãÃÓ\n" 
            ^
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.12.4/lib/bundler/runtime.rb:100:in `rescue in block in require' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.12.4/lib/bundler/runtime.rb:77:in `block in require' 
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.12.4/lib/bundler/runtime.rb:70:in `each' 

ho ottenuto la soluzione da qui pdf-writer invalid multibyte char (US-ASCII) expecting keyword_end content = "%PDF-#{@version}\n%âãÏÓ\n" Rails 3

ho cambiato gemfilepdf-writer a

gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'

Ora, quando corro Bundler per installare il pdf-writer gemma ottengo timeout errore come di seguito

github.com[0: 192.30.252.123]: errno=Connection timed out 
fatal: unable to connect a socket (Connection timed out) 
Retrying git clone 'git://github.com/metaskills/pdf-writer.git' "/usr/local/lib/ruby/gems/1.9.1/cache/bundler/git/pdf-writer-ce9b6a7a72845526358421df666643f35691567f" --bare --no-hardlinks --quiet due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git://github.com/metaskills/pdf-writer.git' "/usr/local/lib/ruby/gems/1.9.1/cache/bundler/git/pdf-writer-ce9b6a7a72845526358421df666643f35691567f" --bare --no-hardlinks --quiet` in directory /apps/hours_report_3/current has failed. 
github.com[0: 192.30.252.123]: errno=Connection timed out 
fatal: unable to connect a socket (Connection timed out) 
Git error: command `git clone 'git://github.com/metaskills/pdf-writer.git' 
"/usr/local/lib/ruby/gems/1.9.1/cache/bundler/git/pdf-writer-ce9b6a7a72845526358421df666643f35691567f" --bare --no-hardlinks --quiet` in directory 
/apps/my_dashboard/current has failed. 
+0

sembra che il nome file fosse in UTF-8 ma interpretato come ASCII, ma ruba ASII non supportato in questo modo, quindi come è stata generata la riga di contenuto? –

+0

Sto appena iniziando un server sottile e questo registro sottile registrato – veer7

+0

cambia in 'gem 'pdf-writer', github: 'metaskills/pdf-writer'' –

risposta

0

Quindi questo potrebbe essere un paio di questioni diverse. Per il primo errore, si potrebbe aggiunge codifica esplicita in cima /usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb -

# encoding: utf-8 

Questo sarebbe hacking in una libreria vecchio e fragile nella migliore delle ipotesi, come il vostro Gemfile non sarebbe portabile su altre macchine.

Per il secondo errore, sembra che potrebbe esserci un conflitto tra la gem esistente nella cache e quella remota che si sta tentando di installare, poiché hanno lo stesso nome.

Si potrebbe provare a disinstallare localmente per cancellare il Cache

gem uninstall pdf-writer 

E poi attorcigliato nuovo-

bundle install 

Ruby 1.9.3 raggiunto la fine della vita in February 2015, quindi questo non è una situazione ideale , ma dati i vincoli, questo dovrebbe farti andare.